ruder

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
  protected static object GetValueByType(PropertyInfo info,T obj)
        {
            if (info.PropertyType.Name == "DateTime" && Convert.ToDateTime(info.GetValue(obj, null))==DateTime.MinValue)
            {   
                return DateTime.Parse("1900/1/1");     
            }
            object newObj = info.GetValue(obj, null);
            if (newObj != null)
            {
                return newObj;
            }
          
            if (info.PropertyType.Name == "String")
            {
                return String.Empty;
            }
            return null;
        }
posted on 2009-04-29 17:41  徐境  阅读(141)  评论(0)    收藏  举报