public static bool IsNullableType(this Type type) { return type.IsConstructedGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); }