2014年3月25日

C#利用反射,遍历获得一个类的所有属性名,以及该类的实例的所有属性的值

摘要: 属性类 temp = new 属性类();string s = string.Empty;foreach (System.Reflection.PropertyInfo info in typeof(类名.属性类).GetProperties()) { txtResult.AppendText("【"+info.Name + "】:"+info.GetValue(temp, null) + "\r\n"); }输出结果:【itemId】:3580447722220【title】:2014四大容量大包手提单肩包女士包【pic_url】: 阅读全文

posted @ 2014-03-25 22:29 nanphon 阅读(259) 评论(0) 推荐(0) 编辑

导航