0
我试图从一个类获取基于字符串的成员,然后获取类型,但我没有任何运气。C#或VB:从属性获取变量类型
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()
不管我什么组合,我要么什么也得不到或RuntimePropertyType
Dim x = fieldMemberInfo.GetType