If I have a Type, is there some easy way to tell that it represents a nullable value type using Reflection? Ideally something a little cleaner (and more correct) than:
static bool IsNullable(Type type)
{
return type.IsValueType && type.Name.StartsWith("Nullable");
}
You might also find
Nullable.GetUnderlyingType(Type nullableType)useful, to easily get theTof thetypeof(Nullable<T>)you pass in.