Пример #1
0
        public static bool IsBlittable(this Mono.Cecil.TypeReference type)
        {
            if (type.IsPrimitive || type.IsTypeOf <IntPtr>() || type.IsTypeOf <UIntPtr>())
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        public static string GetFieldTypeName(this Mono.Cecil.TypeReference type)
        {
            if (type.IsTypeOf <Byte>())
            {
                return("byte");
            }
            if (type.IsTypeOf <SByte>())
            {
                return("sbyte");
            }
            if (type.IsTypeOf <Int16>())
            {
                return("short");
            }
            if (type.IsTypeOf <UInt16>())
            {
                return("ushort");
            }
            if (type.IsTypeOf <Int32>())
            {
                return("int");
            }
            if (type.IsTypeOf <UInt32>())
            {
                return("uint");
            }
            if (type.IsTypeOf <Int64>())
            {
                return("long");
            }
            if (type.IsTypeOf <UInt64>())
            {
                return("ulong");
            }

            if (type.IsTypeOf <IntPtr>())
            {
                return("iptr");
            }
            if (type.IsTypeOf <UIntPtr>())
            {
                return("uptr");
            }

            if (type.IsTypeOf <Single>())
            {
                return("float");
            }
            if (type.IsTypeOf <Double>())
            {
                return("double");
            }

            return(type.ToString().Replace("/", "."));
        }