///obj  实体

///property 属性名称

 public static object get(object obj, string property)     {   
return obj.GetType().InvokeMember(property, System.Reflection.BindingFlags.GetProperty, null, obj, null);
}


方法二
propertys = obj.GetType().GetProperty(property );
if (propertys != null)
return propertys.GetValue(obj, null);
else
throw new Exception(obj.GetType().FullName + "没有此属性" + ps[index]);

posted on 2012-08-14 14:40  开心技术  阅读(203)  评论(0编辑  收藏  举报