Example #1
0
        void Initialize(Type type)
        {
            Type = type;
            var ti = type.GetTypeInfo();

            Kind          = PrimitiveConverter.GetPrimitiveType(type);
            IsReference   = !ti.IsValueType;
            BaseType      = GetType(Type.GetTypeInfo().BaseType);
            IsMscorlib    = IsFromMscorlib(type);
            IsAbstract    = type.GetTypeInfo().IsAbstract;
            IsGenericMeta = IsUndefined(type);

            if (type.IsPointer)
            {
                IsIgnored = true;
            }
            else if (typeof(Delegate).IsBaseClass(type) || type == typeof(IntPtr) || type == typeof(Enum))
            {
                IsIgnored = true;
            }
            if (IsIgnored)
            {
                return;
            }

            if (!type.IsArray && !ti.IsEnum)
            {
                SetConstructor();
            }
        }
Example #2
0
        void Initialize(Type type)
        {
            Type = type;
            var ti = type.GetTypeInfo();

            Kind          = PrimitiveConverter.GetPrimitiveType(type);
            IsReference   = !ti.IsValueType;
            BaseType      = GetType(Type.GetTypeInfo().BaseType);
            IsMscorlib    = IsFromMscorlib(type);
            IsAbstract    = type.GetTypeInfo().IsAbstract || type.IsInterface || ((type.Attributes & TypeAttributes.Abstract) != 0);
            IsGenericMeta = IsUndefined(type);

            if (!type.IsArray && !ti.IsEnum && !IsAbstract && !IsGenericMeta)
            {
                SetConstructor();
            }
        }
Example #3
0
        /// <summary>
        /// Get the <see cref="FastType"/> associated with each primitive type. Except for object, where it returns null.
        /// </summary>
        public static FastType GetType(PrimitiveType kind)
        {
            var type = PrimitiveConverter.GetType(kind);

            return(GetType(type));
        }