Reputation: 7359
I have the next class in my code:
Public Class MyClass
Public Class MyDictionary
Public Shared Property something As String = "xxxxx"
...
End Class
Public Property dbId As Integer
Public Property dbDescription As String
Public Property Activate As Boolean
...
End Class
What I am trying to do is to look for propertyInfo of MyDictionary class using Linq.
I tried to use
Dim propertyInfo = typeDest.GetProperty("MyDictionary", BindingFlags.IgnoreCase Or BindingFlags.Public Or BindingFlags.Instance)
But is returning me Nothing.
Is it possible to do?
Upvotes: 0
Views: 99
Reputation: 117084
MyDictionary
isn't a property. It's a class. You can't find it with GetProperty
.
You'd have to do something like this:
Dim myDictionaryType As Type = _
GetType([MyClass]) _
.Assembly _
.GetTypes() _
.Where(Function(x) x.FullName.StartsWith(GetType([MyClass]).FullName)) _
.Where(Function(x) x.Name = "MyDictionary")
.FirstOrDefault()
Upvotes: 1