public static EnumContractInfo TryCreate([CanBeNull] IEnum enumType)
            {
                if (enumType != null && enumType.HasAttributeInstance(PredefinedType.FLAGS_ATTRIBUTE_CLASS, false))
                {
                    var numericTypeInfo = CSharpNumericTypeInfo.TryCreate(enumType.GetUnderlyingType());
                    if (numericTypeInfo != null)
                    {
                        Debug.Assert(enumType.EnumMembers != null);

                        return(numericTypeInfo.TryCreateEnumFlags(enumType.EnumMembers));
                    }
                }

                return(null);
            }
        protected sealed override bool IsAvailableForType(IType type)
        {
            NumericTypeInfo = CSharpNumericTypeInfo.TryCreate(type);

            if (NumericTypeInfo != null)
            {
                if (NumericTypeInfo.IsSigned)
                {
                    return(true);
                }

                NumericTypeInfo = null;
            }

            return(false);
        }
Esempio n. 3
0
        protected sealed override bool IsAvailableForType(IType type)
        {
            NumericTypeInfo = CSharpNumericTypeInfo.TryCreate(type);

            return(NumericTypeInfo != null);
        }