コード例 #1
0
 public static Type GetNonNullableType(Type type)
 {
     if (AtkTypeHelper.IsNullableType(type))
     {
         return(type.GetGenericArguments()[0]);
     }
     return(type);
 }
コード例 #2
0
 public static object GetDefault(Type type)
 {
     if (type.IsValueType && !AtkTypeHelper.IsNullableType(type))
     {
         return(Activator.CreateInstance(type));
     }
     return((object)null);
 }
コード例 #3
0
        public static object GetDefault(Type type)
        {
            bool isNullable = !type.IsValueType || AtkTypeHelper.IsNullableType(type);

            if (!isNullable)
            {
                return(Activator.CreateInstance(type));
            }
            return(null);
        }
コード例 #4
0
 public static bool IsNullAssignable(Type type)
 {
     return(!type.IsValueType || AtkTypeHelper.IsNullableType(type));
 }