我想問問那些關於代碼優化的vb.net專家。我的例子是VB.Net代碼優化?
a。
Dim lblEventCategory = CType(Me.gvSpecialEvent.Rows(e.NewEditIndex).FindControl("lblEventCategory"), Label)
b。
Dim lblEventCategory As Label = CType(Me.gvSpecialEvent.Rows(e.NewEditIndex).FindControl("lblEventCategory"), Label)
哪兩個更有效率是字母A?或字母B?
有人能幫我理解這些代碼嗎?
預先感謝
不正確。在vb2008之前,第一個被定義爲對象類型,而不是變體。在vb2008中(假設Option Infer On)被定義爲一個標籤。 – ggf31416 2009-06-01 10:56:08
在VB.NET中不存在變體類型。 – 2009-06-01 13:50:27