我正在尝试根据类中的字符串获取成员,然后获取类型,但我没有任何运气。
Public Class Monster
Public Property Name As String
Public Property EatsPeople As Boolean
Public Property Description As String
End Class
要获取成员“EatsPeople”的详细信息,我会:
Dim t = GetType(Monster) ' Get the type of the Product entity.
Dim fieldMemberInfo = t.GetMember("EatsPeople", BindingFlags.IgnoreCase Or BindingFlags.Public Or BindingFlags.Instance).Single()
无论我尝试什么组合,我都会得到 Nothing 或 RuntimePropertyType
Dim x = fieldMemberInfo.GetType