判断一个类型是否为可空类型 System Nullable

bool IsNullableType(Type theType)  
{  
    return (theType.IsGenericType && theType.  
      GetGenericTypeDefinition().Equals  
      (typeof(Nullable<>)));  
}  

posted @ 2019-08-13 15:35  左正  阅读(615)  评论(0编辑  收藏  举报