IsNullable() public static method

public static IsNullable ( Type t ) : bool
t System.Type
return bool
Esempio n. 1
0
        private static string HandleRequiredAttribute(PropertyInfo prop, IEnumerable <CustomAttributeData> customAttributes)
        {
            var res = string.Empty;

            if (customAttributes.Any(a => a.AttributeType == typeof(RequiredAttribute)))
            {
                res += ", \"required\": true";
            }
            else if (TypeBuilderHelper.IsNullable(prop.PropertyType))
            {
                res += ", \"required\": false";
            }
            return(res);
        }
 private static bool IsOptionalProperty(PropertyInfo prop, IEnumerable <CustomAttributeData> customAttributes)
 {
     return(customAttributes.All(a => a.AttributeType != typeof(RequiredAttribute)) && TypeBuilderHelper.IsNullable(prop.PropertyType));
 }