예제 #1
0
        // Token: 0x06000C05 RID: 3077 RVA: 0x000432D8 File Offset: 0x000414D8
        public virtual bool tmethod_2162(Type arg_0)
        {
            if (typeof(IEnumerable).IsAssignableFrom(arg_0))
            {
                return(false);
            }
            object[] customAttributes = arg_0.GetCustomAttributes(true);
            bool     flag             = false;

            foreach (object obj in customAttributes)
            {
                Type type = obj.GetType();
                if (type.FullName == "Microsoft.FSharp.Core.CompilationMappingAttribute")
                {
                    Class_484.EnsureInitialized(type.Assembly);
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                return(false);
            }
            Class_489 <object, object> isUnion = Class_484.IsUnion;
            object target = null;

            object[] array2 = new object[2];
            array2[0] = arg_0;
            return((bool)isUnion(target, array2));
        }
예제 #2
0
        // Token: 0x06001422 RID: 5154 RVA: 0x0005EB54 File Offset: 0x0005CD54
        public Class_453(Type arg_0) : base(arg_0)
        {
            this.field_5 = Class_448.Dictionary;
            Type type;
            Type type2;

            if (Class_514.ImplementsGenericDefinition(arg_0, typeof(IDictionary <, >), out this.field_0))
            {
                type  = this.field_0.GetGenericArguments()[0];
                type2 = this.field_0.GetGenericArguments()[1];
                if (Class_514.IsGenericDefinition(base.prop_0, typeof(IDictionary <, >)))
                {
                    base.prop_1 = typeof(Dictionary <, >).MakeGenericType(new Type[]
                    {
                        type,
                        type2
                    });
                }
            }
            else
            {
                Class_514.GetDictionaryKeyValueTypes(base.prop_0, out type, out type2);
                if (base.prop_0 == typeof(IDictionary))
                {
                    base.prop_1 = typeof(Dictionary <object, object>);
                }
            }
            if (type != null && type2 != null)
            {
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(base.prop_1, typeof(KeyValuePair <, >).MakeGenericType(new Type[]
                {
                    type,
                    type2
                }));
                if (!this.prop_6 && arg_0.Name == "FSharpMap`2")
                {
                    Class_484.EnsureInitialized(arg_0.Assembly);
                    this.field_5 = Class_484.CreateMap(type, type2);
                }
            }
            this.prop_4 = !typeof(IDictionary).IsAssignableFrom(base.prop_1);
            this.prop_1 = type;
            this.prop_2 = type2;
        }
예제 #3
0
        // Token: 0x06001403 RID: 5123 RVA: 0x0005E5A4 File Offset: 0x0005C7A4
        public Class_447(Type arg_0) : base(arg_0)
        {
            this.field_5 = Class_448.Array;
            this.prop_2  = base.prop_1.IsArray;
            bool bool_;
            Type type;

            if (this.prop_2)
            {
                this.prop_0  = Class_514.GetCollectionItemType(base.prop_0);
                this.field_6 = true;
                this.field_0 = typeof(List <>).MakeGenericType(new Type[]
                {
                    this.prop_0
                });
                bool_       = true;
                this.prop_1 = (this.prop_2 && base.prop_0.GetArrayRank() > 1);
            }
            else if (typeof(IList).IsAssignableFrom(arg_0))
            {
                if (Class_514.ImplementsGenericDefinition(arg_0, typeof(ICollection <>), out this.field_0))
                {
                    this.prop_0 = this.field_0.GetGenericArguments()[0];
                }
                else
                {
                    this.prop_0 = Class_514.GetCollectionItemType(arg_0);
                }
                if (arg_0 == typeof(IList))
                {
                    base.prop_1 = typeof(List <object>);
                }
                if (this.prop_0 != null)
                {
                    this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                }
                this.field_6 = Class_514.InheritsGenericDefinition(arg_0, typeof(ReadOnlyCollection <>));
                bool_        = true;
            }
            else if (Class_514.ImplementsGenericDefinition(arg_0, typeof(ICollection <>), out this.field_0))
            {
                this.prop_0 = this.field_0.GetGenericArguments()[0];
                if (Class_514.IsGenericDefinition(arg_0, typeof(ICollection <>)) || Class_514.IsGenericDefinition(arg_0, typeof(IList <>)))
                {
                    base.prop_1 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                if (Class_514.IsGenericDefinition(arg_0, typeof(ISet <>)))
                {
                    base.prop_1 = typeof(HashSet <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                bool_        = true;
                this.prop_3  = true;
            }
            else if (Class_514.ImplementsGenericDefinition(arg_0, typeof(IEnumerable <>), out type))
            {
                this.prop_0 = type.GetGenericArguments()[0];
                if (Class_514.IsGenericDefinition(base.prop_0, typeof(IEnumerable <>)))
                {
                    base.prop_1 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                }
                this.field_4 = Class_510.ResolveEnumerableCollectionConstructor(arg_0, this.prop_0);
                if (!this.prop_6 && arg_0.Name == "FSharpList`1")
                {
                    Class_484.EnsureInitialized(arg_0.Assembly);
                    this.field_5 = Class_484.CreateSeq(this.prop_0);
                }
                if (arg_0.IsGenericType && arg_0.GetGenericTypeDefinition() == typeof(IEnumerable <>))
                {
                    this.field_0 = type;
                    this.field_6 = false;
                    this.prop_3  = false;
                    bool_        = true;
                }
                else
                {
                    this.field_0 = typeof(List <>).MakeGenericType(new Type[]
                    {
                        this.prop_0
                    });
                    this.field_6 = true;
                    this.prop_3  = true;
                    bool_        = this.prop_6;
                }
            }
            else
            {
                bool_       = false;
                this.prop_3 = true;
            }
            this.prop_4 = bool_;
        }