我爱Aspx >> Asp.Net >> type 进行反射时。setvalue的问题会出错。定义的字段“clmc”不是类型为“System.String”的目标对象上的字段。代码public class tbaseEntity
google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";
{
private int mm;
public int pid;
public string mc;
}
public class Tclentity : tbaseEntity
{
private string abc;
public System.String clmc;
}
Tclentity acl = new Tclentity();
settoclass(acl, "怎么");
public void settoclass(tbaseEntity aEntity,string mm)
{
FieldInfo[] Pinfo = aEntity.GetType().GetFields();
foreach (FieldInfo aInfo in Pinfo)
{
if (aInfo.FieldType.FullName =="System.String")
{
aInfo.SetValue(aInfo.Name ,mm);
break;
}
}
aInfo.SetValue(aInfo.Name ,mm); 这一句出出错。具体提示:
System.ArgumentException: 类型“Service+Tclentity”上定义的字段“clmc”不是类型为“System.String”的目标对象上的字段。
Ҷƪл˵?
一个我感觉很难的问题,请教高手..[07-06]
求用DataSet绑定DataGridView,实..[07-06]
串口通讯中的7位数据位,和8位数..[07-06]
<^o^> 请问做[图形报表]有..[07-06]
三层结构搭建[07-06]
★急急急,各位给推荐个硬盘工具,..[07-06]
求ASP.NET办公自动化系统开发实例..[07-06]
如何控制窗体当前只有1个实例[07-06]
vc#写的winform程序很占内存,如..[07-06]
怎么让浏览器显示自己的html文档[07-06]