0
我一直在閱讀這個的其他例子,我似乎可以通過傳遞它的名字來賦值我的字段的值。通過傳遞它的名字來指定一個字段值
private string fieldName; //contains the name of the field I want to edit
void IObserver.Update(object data)
{
FieldInfo field = this.GetType().GetField(fieldName);
if(field != null)
{
field.SetValue(this, data);
}
}
場最終總是空,我無法弄清楚,爲什麼
請向我們展示這堂課。 – SLaks