vb.net 相当于vb6的函数属性
vb.net equivalent of vb6 function attributes
我在 vb6
中有以下 class:
Public Function NewEnum()
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
NewEnum = mcolFields.[_NewEnum]
End Function
vb.net?
中的等效属性是什么我知道您必须将属性放在 <>
中,我还发现 this SO post,但是它没有'解决我的问题。
There is one more special value for VB_UserMemId and that value is -4.
Negative 4 always indicates that the function being marked should
return a [_NewEnum] enumerator.
我会说在这种情况下你可以忽略它们。所以你的等价物应该是这样的:
Public Function NewEnum() As mcolFields
Return New mcolFields
End Function
GetEnumerator() 是完全等价的。它在 <ComVisible(True)>
代码中作为 NewEnum 公开。只需实现 System.Collections.IEnumerable 接口,即非泛型接口。
我在 vb6
中有以下 class:
Public Function NewEnum()
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
NewEnum = mcolFields.[_NewEnum]
End Function
vb.net?
中的等效属性是什么我知道您必须将属性放在 <>
中,我还发现 this SO post,但是它没有'解决我的问题。
There is one more special value for VB_UserMemId and that value is -4. Negative 4 always indicates that the function being marked should return a [_NewEnum] enumerator.
我会说在这种情况下你可以忽略它们。所以你的等价物应该是这样的:
Public Function NewEnum() As mcolFields
Return New mcolFields
End Function
GetEnumerator() 是完全等价的。它在 <ComVisible(True)>
代码中作为 NewEnum 公开。只需实现 System.Collections.IEnumerable 接口,即非泛型接口。