土豆烧牛肉

导航

 

public static string GetObjectPropertyValue<T>(T t, string propertyname)
{
     Type type = typeof(T);

      PropertyInfo property = type.GetProperty(propertyname);

      if (property == null) return string.Empty;

      object o = property.GetValue(t, null);

      if (o == null) return string.Empty;

      return o.ToString();
}
posted on 2014-06-30 17:37  土豆烧牛肉  阅读(353)  评论(0编辑  收藏  举报