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