我想在运行时得到一个类memeber变量列表。我知道这可能使用typeof和反射。但找不到示例。请有人为我散光。C#VS 2005:如何在运行时获取类的公共成员列表?
下面是伪代码示例:
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
做到这一点非常感谢
非常感谢。这太棒了。 – simon 2008-12-04 07:37:38