当我尝试这样做时,我有一个带有当前对象中字段名称的 ArrayList:
foreach(string name in array)
{
PropertyInfo property = this.GetType().GetProperty(name);
property.SetValue(this, value , null);
}
执行失败,并且该属性没有值(在 SharpDevelop 中只说“null”)。字段名称正常且存在,会发生什么?
当我尝试这样做时,我有一个带有当前对象中字段名称的 ArrayList:
foreach(string name in array)
{
PropertyInfo property = this.GetType().GetProperty(name);
property.SetValue(this, value , null);
}
执行失败,并且该属性没有值(在 SharpDevelop 中只说“null”)。字段名称正常且存在,会发生什么?