• λ我爱Aspx >> Asp.Net >> type 进行反射时。setvalue的问题会出错。定义的字段“clmc”不是类型为“System.String”的目标对象上的字段。代码
  • type 进行反射时。setvalue的问题会出错。定义的字段“clmc”不是类型为“System.String”的目标对象上的字段。代码

  • :aspxer  Դ:csdn  :2007-7-6 2:51:07  ؼ:
  • 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”的目标对象上的字段。

    Ҷƪл˵?
  • һƪ怎么在另一个项目中调用一个做好的用户控件
    һƪ一个我感觉很难的问题,请教高手解答。