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