May 07, 2012
This is a nice little snippet to check if a type is nullable:public static bool IsNullableType(Type type) {
if(!type.IsGeneric) {
return false;
}
if(type.GetGenericTypeDefinition() == typeof(Nullable<>)) {
return true;
}
else {
return false;
}
}
This is a restructured version of Snippet: Check if type is Nullable (C# 2.0) or not (C#)
Comments
comments powered by Disqus