Possible Duplicate:
How to check if an object is nullable?
I have a System.Type object which may be a Nullable<T>
. How would I determine this at runtime?
Note: At this point I don't care what T is, I just need to know whether or not it is a Nullable.
Possible duplicate:
How to check if an object is nullable?
if not..
bool IsNullableType(Type theType)
{
return (theType.IsGenericType &&
theType.GetGenericTypeDefinition().Equals(typeof(Nullable<>)));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With