I know merely checking for whether the type is not a value type is not sufficient. How can i account for those Nullable?
DUPLICATE
http://stackoverflow.com/questions/374651/how-to-check-if-an-object-is-nullable
I know merely checking for whether the type is not a value type is not sufficient. How can i account for those Nullable?
DUPLICATE
http://stackoverflow.com/questions/374651/how-to-check-if-an-object-is-nullable
You can use Nullable.GetUnderlyingType that will return null if the type is not nullable.
have you tried the keyword default(YourType) ?
Whether T will be a reference type or a value type.
If T is a value type, whether it will be a numeric value or a struct.
This also works:
bool nullable = yourType.IsGenericType && yourType.GetGenericTypeDefinition().Equals(typeof(Nullable<>))