Mono.Cecil.Mixin.IsPrimitive C# (CSharp) Method

IsPrimitive() public static method

public static IsPrimitive ( this self ) : bool
self this
return bool
        public static bool IsPrimitive(this ElementType self)
        {
            switch (self) {
            case ElementType.Boolean:
            case ElementType.Char:
            case ElementType.I:
            case ElementType.U:
            case ElementType.I1:
            case ElementType.U1:
            case ElementType.I2:
            case ElementType.U2:
            case ElementType.I4:
            case ElementType.U4:
            case ElementType.I8:
            case ElementType.U8:
            case ElementType.R4:
            case ElementType.R8:
                return true;
            default:
                return false;
            }
        }

Usage Example

Esempio n. 1
0
        public static bool TryGetPrimitiveElementType(TypeDefinition type, out ElementType etype)
        {
            etype = ElementType.None;

            if (type.Namespace != "System")
            {
                return(false);
            }

            Row <ElementType, bool> primitive_data;

            if (TryGetPrimitiveData(type, out primitive_data) && Mixin.IsPrimitive(primitive_data.Col1))
            {
                etype = primitive_data.Col1;
                return(true);
            }

            return(false);
        }