Reputation: 685
I have the follow class in vb6
:
Public Function NewEnum()
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
NewEnum = mcolFields.[_NewEnum]
End Function
What would the equivalent attributes be in vb.net?
I know that you have to put attributes in <>
and I also found this SO post, however it didn't solve my problem.
Upvotes: 1
Views: 370
Reputation: 941744
GetEnumerator() is the exact equivalent. It gets exposed as NewEnum in <ComVisible(True)>
code. Simply implement the System.Collections.IEnumerable interface, the non-generic one.
Upvotes: 3
Reputation: 27342
Some info about this is here: https://christopherjmcclellan.wordpress.com/2015/04/21/vb-attributes-what-are-they-and-why-should-we-use-them/
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.
I would say that in this case you can ignore them. So your equivalent should be something like this:
Public Function NewEnum() As mcolFields
Return New mcolFields
End Function
Upvotes: 1