【发布时间】:2010-09-25 06:49:07
【问题描述】:
我试图在运行时获取类成员变量列表。我知道这可能使用 typeof 和反射。但找不到一个例子。请有人为我解惑。
这是伪代码示例:
Class Test01
{
public string str01;
public string str02;
public int myint01;
}
我想要这样的东西(伪代码):
Test01 tt = new Test01();
foreach(variable v in tt.PublicVariableList)
{
debug.print v.name;
debug.print v.type;
}
请帮我弄清楚如何在 C# VS2005 中做到这一点
非常感谢
【问题讨论】:
标签: c# reflection typeof