我想在運行時得到一個類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