I may be a little late to this thread but the same issue has been driving me crazy. My confusion was componded by the C# to VB converter I used.
It translated the Metadata line as:
<MetadataType(Type.GetType(ContactMetadata))>
This shows as incorrect with ContactMetadata flagged as the wrong type for the expression.
I finally realized that the problem is that GETTYPE exists in more than one namespace. Type.GetType requires a string argument, e.g. "System.String". However there is also a gettype in the system.object namespace that accepts an object
I think the correct VB syntax is simply GetType(ContactMetadata). It's not really calling a method, but it's more of a keyword, which matches typeof() in C#.
I would HIGHLY recommend learning at least enough C# to translate code snippits on the web. This page has helped me alot coming from the other direction, when I have had to touch VB.net apps in the past.
http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
Please remember to Mark As Answered if this post has answered your question
rkrumm
Member
2 Points
1 Post
Re: Problem with custome Class VB.NET
Jun 12, 2008 06:35 PM|LINK
I may be a little late to this thread but the same issue has been driving me crazy. My confusion was componded by the C# to VB converter I used.
It translated the Metadata line as:
<MetadataType(Type.GetType(ContactMetadata))>
This shows as incorrect with ContactMetadata flagged as the wrong type for the expression.
I finally realized that the problem is that GETTYPE exists in more than one namespace. Type.GetType requires a string argument, e.g. "System.String". However there is also a gettype in the system.object namespace that accepts an object
Thus the correct syntax is:
<MetadataType(Object.GetType(ContactMetadata))>
Took me a whole day to figure is this out.
VB metadata gettype
davidebb
Contributor
7006 Points
1366 Posts
Microsoft
Re: Problem with custome Class VB.NET
Jun 12, 2008 06:42 PM|LINK
I think the correct VB syntax is simply GetType(ContactMetadata). It's not really calling a method, but it's more of a keyword, which matches typeof() in C#.
David
mattbriggs
Member
407 Points
73 Posts
Re: Problem with custome Class VB.NET
Jun 12, 2008 07:50 PM|LINK
I would HIGHLY recommend learning at least enough C# to translate code snippits on the web. This page has helped me alot coming from the other direction, when I have had to touch VB.net apps in the past. http://www.harding.edu/fmccown/vbnet_csharp_comparison.html