Exemple #1
0
        public static object GetDefault(Type type)
        {
            object result;

            if (type.IsValueType && !AiTypeHelper.IsNullableType(type))
            {
                result = Activator.CreateInstance(type);
            }
            else
            {
                result = null;
            }
            return(result);
        }
Exemple #2
0
        public static Type GetNonNullableType(Type type)
        {
            Type result;

            if (AiTypeHelper.IsNullableType(type))
            {
                result = type.GetGenericArguments()[0];
            }
            else
            {
                result = type;
            }
            return(result);
        }
Exemple #3
0
 public static bool IsNullAssignable(Type type)
 {
     return(!type.IsValueType || AiTypeHelper.IsNullableType(type));
 }