我想问问那些关于代码优化的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