public static Type GetNonNullableType(Type type) { if (AtkTypeHelper.IsNullableType(type)) { return(type.GetGenericArguments()[0]); } return(type); }
public static object GetDefault(Type type) { if (type.IsValueType && !AtkTypeHelper.IsNullableType(type)) { return(Activator.CreateInstance(type)); } return((object)null); }
public static object GetDefault(Type type) { bool isNullable = !type.IsValueType || AtkTypeHelper.IsNullableType(type); if (!isNullable) { return(Activator.CreateInstance(type)); } return(null); }
public static bool IsNullAssignable(Type type) { return(!type.IsValueType || AtkTypeHelper.IsNullableType(type)); }