标签:对象 userinfo blog void style color bsp lin console
C#获得对象的所有属性和值
public void GetPros() { UserInfo userInfo = new UserInfo(); userInfo.ID = 1; userInfo.Name = "jay"; foreach (System.Reflection.PropertyInfo p in userInfo.GetType().GetProperties()) { Console.WriteLine("Name:{0} Value:{1}", p.Name, p.GetValue(userInfo)); } }
标签:对象 userinfo blog void style color bsp lin console
原文地址:http://www.cnblogs.com/xsj1989/p/7802907.html