首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#怎么获取object对象的属性值

2012-10-08 
C#如何获取object对象的属性值public static object GetPropertyValue(object info, string field){if (in

C#如何获取object对象的属性值

        public static object GetPropertyValue(object info, string field){if (info == null) return null;Type t = info.GetType();IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi;            return property.First().GetValue(info, null);        } 
?

热点排行