111,126
社区成员
发帖
与我相关
我的任务
分享class con
{
public static constanttype cons
{
get
{
return new constanttype
{
a = new constants { name = "ty", value = 1 },
b = new constants { name = "zy", value = 2 }
};
}
}
}
class constants
{
public string name { get; set; }
public int value { get; set; }
}
class constanttype
{
public constants a { get; set; }
public constants b { get; set; }
}Type t = con.consts.GetType ();
foreach (var ex in t.GetProperties())
{
object ab = ex.GetValue(con .consts ,null);
}