【发布时间】:2016-07-13 13:48:16
【问题描述】:
我有一个具有某些类型属性的对象:
public class MyClass
{
public List<SomeObj> List { get; set; }
public int SomeKey { get; set; }
public string SomeString { get; set; }
}
var obj = new MyClass();
获取obj MyClass 实例的所有类型属性的最佳方法是什么?
例如:
obj.GetAllPropertiesTypes() //int, string, List<>
obj.HasPropertyType("int") //True
【问题讨论】:
-
obj.GetType().GetProperties();
标签: c#