public static MethodInfo GetNullableHasValueMethod(this Type type) { type = type.GetNonNullableType(); return(NullableHasValueMethods.GetOrAdd(type, key => NullableType.MakeGenericType(key).GetProperty("HasValue").GetGetMethod())); }
private static object NewNullableInstanceSlow(Type type) { Type concrete = NullableType.MakeGenericType(type); return(Activator.CreateInstance(concrete)); }