111,125
社区成员
发帖
与我相关
我的任务
分享
public class A
{
public string Name { get; set; }
}
A a = new A();
PropertyInfo p = typeof(A).GetProperty("Name");
p.SetValue(a, 10, null);
这个就会直接报错的。
public class A
{
public string Name { get; set; }
}
A a = new A();
PropertyInfo p = typeof(A).GetProperty("Name");
p.SetValue(a, 10, null);
string Name;
int i = 10;
Name = i;
你确定不报错?