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);
}
}
필드는 항상 null 끝과 닷넷 반사
수업을 보여주십시오. – SLaks