我正在使用 GetProperties 来获取一个类的属性列表。
Dim properties As List(Of PropertyInfo) = objType.GetProperties(BindingFlags.Instance Or BindingFlags.Public).ToList()
For Each prop As PropertyInfo In properties
'how do I get the parent class type of the prop (level up in hierarchy from property's ReflectedType)?
Next
如何让父类比当前属性高一级ReflectedType
?请注意,此类可能有多个父级别。我不想要BaseType
当前属性的类,而只是属性层次结构中的下一个级别ReflectedType
作为属性可能有好几层深。