获取类的属性名和值

            NormalModel model =new Normal(){Id="001",Name="dp"};
       Type type = model.GetType(); //获取类型 foreach (PropertyInfo pi in type.GetProperties()) { result += pi.Name + "=" + pi.GetValue(model, null) + "&"; }

 

posted @ 2017-02-10 17:03  pding  阅读(285)  评论(0编辑  收藏  举报