Example #1
0
 internal Interface15 method_5(object object_0)
 {
     if (this.delegate3_0 == null)
     {
         Type type;
         this.type_4 = typeof(Class183 <>).MakeGenericType(new Type[] { this.CollectionItemType });
         if (!Class194.smethod_15(this.type_3, typeof(List <>)) && !(this.type_3.GetGenericTypeDefinition() == typeof(IEnumerable <>)))
         {
             type = this.type_3;
         }
         else
         {
             type = typeof(ICollection <>).MakeGenericType(new Type[] { this.CollectionItemType });
         }
         ConstructorInfo constructor = this.type_4.GetConstructor(new Type[] { type });
         this.delegate3_0 = Class139.Class166_0.ns20.Class166.‫‌‪‭‭‪‌‎‮‬​‌‌‬‎‮‌‏‌‎‪‌‏‬‫‭‮ <object>(constructor);
     }
     return((Interface15)this.delegate3_0(null, new object[] { object_0 }));
 }
Example #2
0
        public JsonArrayContract(Type underlyingType) : base(underlyingType)
        {
            bool flag;

            base.enum15_0 = Enum15.Array;
            if (base.CreatedType.IsArray)
            {
                this.CollectionItemType = Class194.smethod_18(base.UnderlyingType);
                base.bool_4             = true;
                this.type_3             = typeof(List <>).MakeGenericType(new Type[] { this.CollectionItemType });
                flag = true;
                this.IsMultidimensionalArray = base.UnderlyingType.IsArray && (base.UnderlyingType.GetArrayRank() > 1);
            }
            else if (typeof(IList).IsAssignableFrom(underlyingType))
            {
                if (Class194.smethod_14(underlyingType, typeof(ICollection <>), out this.type_3))
                {
                    this.CollectionItemType = this.type_3.GetGenericArguments()[0];
                }
                else
                {
                    this.CollectionItemType = Class194.smethod_18(underlyingType);
                }
                if (underlyingType == typeof(IList))
                {
                    base.CreatedType = typeof(List <object>);
                }
                if (this.CollectionItemType != null)
                {
                    this.ConstructorInfo_0 = Class191.smethod_3(underlyingType, this.CollectionItemType);
                }
                base.bool_4 = Class194.smethod_15(underlyingType, typeof(ReadOnlyCollection <>));
                flag        = true;
            }
            else if (Class194.smethod_14(underlyingType, typeof(ICollection <>), out this.type_3))
            {
                this.CollectionItemType = this.type_3.GetGenericArguments()[0];
                if (Class194.smethod_12(underlyingType, typeof(ICollection <>)) || Class194.smethod_12(underlyingType, typeof(IList <>)))
                {
                    base.CreatedType = typeof(List <>).MakeGenericType(new Type[] { this.CollectionItemType });
                }
                if (Class194.smethod_12(underlyingType, typeof(ISet <>)))
                {
                    base.CreatedType = typeof(HashSet <>).MakeGenericType(new Type[] { this.CollectionItemType });
                }
                this.ConstructorInfo_0 = Class191.smethod_3(underlyingType, this.CollectionItemType);
                flag           = true;
                this.Boolean_0 = true;
            }
            else
            {
                Type type;
                if (Class194.smethod_14(underlyingType, typeof(IEnumerable <>), out type))
                {
                    this.CollectionItemType = type.GetGenericArguments()[0];
                    if (Class194.smethod_12(base.UnderlyingType, typeof(IEnumerable <>)))
                    {
                        base.CreatedType = typeof(List <>).MakeGenericType(new Type[] { this.CollectionItemType });
                    }
                    this.ConstructorInfo_0 = Class191.smethod_3(underlyingType, this.CollectionItemType);
                    if (underlyingType.smethod_4() && (underlyingType.GetGenericTypeDefinition() == typeof(IEnumerable <>)))
                    {
                        this.type_3    = type;
                        base.bool_4    = false;
                        this.Boolean_0 = false;
                        flag           = true;
                    }
                    else
                    {
                        this.type_3    = typeof(List <>).MakeGenericType(new Type[] { this.CollectionItemType });
                        base.bool_4    = true;
                        this.Boolean_0 = true;
                        flag           = this.ConstructorInfo_0 != null;
                    }
                }
                else
                {
                    flag           = false;
                    this.Boolean_0 = true;
                }
            }
            this.Boolean_1 = flag;
            if (this.CollectionItemType != null)
            {
                this.bool_7 = Class194.smethod_10(this.CollectionItemType);
            }
        }