欢迎加我的QQ群:193522571,一起来讨论、交流!

AutoCAD.Net/C#.Net QQ群:193522571 利用反射将父类中的属性传递到子类中,实测效率不高

      foreach (PropertyInfo info in saddle.GetType().GetProperties())
      {
        try
        {
          string objString = info.Name;
          object objValue = saddle.GetType().GetProperty(objString).GetValue(saddle, null);
          this.GetType().GetProperty(objString).SetValue(this, objValue, null);
        }
        catch
        {
        }
      }

 

posted @ 2015-05-08 14:46  swtool  阅读(169)  评论(0编辑  收藏  举报
欢迎加我的QQ群:193522571,一起来讨论、交流!