public string[] tName = new string[]{"Whatever","Doesntmatter"};
string vBob = "Something";
string[] tVars = new string[]{"tName[0]","vBob","tName[1]"};
现在,我要换TNAME [0]的数值,但它不与工作:C#的GetType()getfield命令的排列位置
for(int i = 0; i < tVars.Lenght;++i)
{
this.GetType().GetField("tVars[0]").SetValue(this, ValuesThatComeFromSomewhereElse[i]));
}
我怎样才能做到这一点?
编辑:更改代码以更确切地显示我正在尝试做什么。
/感叹我简单地说明了我的例子。 – Wildhorn 2010-07-09 13:39:03