Exemplo n.º 1
0
 private static void VerifyValueType(object value)
 {
     if (!CollectionWrapper <T> .IsCompatibleObject(value))
     {
         throw new ArgumentException(StringUtils.FormatWith("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.", (IFormatProvider)CultureInfo.InvariantCulture, value, (object)typeof(T)), "value");
     }
 }
Exemplo n.º 2
0
        int IList.Add(object value)
        {
            CollectionWrapper <T> .VerifyValueType(value);

            this.Add((T)value);
            return(this.Count - 1);
        }
Exemplo n.º 3
0
 void System.Collections.IList.Remove(object value)
 {
     if (CollectionWrapper <T> .IsCompatibleObject(value))
     {
         this.Remove((T)value);
     }
 }
Exemplo n.º 4
0
 // Token: 0x06000E69 RID: 3689 RVA: 0x00010F82 File Offset: 0x0000F182
 void IList.Remove(object value)
 {
     if (CollectionWrapper <T> .IsCompatibleObject(value))
     {
         this.Remove((T)((object)value));
     }
 }
Exemplo n.º 5
0
 void IList.Remove(object value)
 {
     if (!CollectionWrapper <T> .IsCompatibleObject(value))
     {
         return;
     }
     this.Remove((T)value);
 }
Exemplo n.º 6
0
 int IList.IndexOf(object value)
 {
     if (this._genericCollection != null)
     {
         throw new InvalidOperationException("Wrapped ICollection<T> does not support IndexOf.");
     }
     return(CollectionWrapper <T> .IsCompatibleObject(value) ? this._list.IndexOf((object)(T)value) : -1);
 }
 bool System.Collections.IList.Contains(object value)
 {
     if (!CollectionWrapper <T> .IsCompatibleObject(value))
     {
         return(false);
     }
     return(this.Contains((T)value));
 }
Exemplo n.º 8
0
        void IList.set_Item(int index, object value)
        {
            if (this._genericCollection != null)
            {
                throw new InvalidOperationException("Wrapped ICollection<T> does not support indexer.");
            }
            CollectionWrapper <T> .VerifyValueType(value);

            this._list[index] = (object)(T)value;
        }
Exemplo n.º 9
0
        // Token: 0x06000E67 RID: 3687 RVA: 0x00010F2F File Offset: 0x0000F12F
        void IList.Insert(int index, object value)
        {
            if (this._genericCollection != null)
            {
                throw new InvalidOperationException("Wrapped ICollection<T> does not support Insert.");
            }
            CollectionWrapper <T> .VerifyValueType(value);

            this._list.Insert(index, (T)((object)value));
        }
        void System.Collections.IList.Insert(int index, object value)
        {
            if (this._genericCollection != null)
            {
                throw new Exception("Wrapped ICollection<T> does not support Insert.");
            }
            CollectionWrapper <T> .VerifyValueType(value);

            this._list.Insert(index, (T)value);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Ensure generic list type can be (de)deserializable on AOT environment.
 /// </summary>
 /// <typeparam name="T">The type of elements in the list</typeparam>
 public static void EnsureList <T>()
 {
     Ensure(() =>
     {
         var a = new List <T>();
         var b = new HashSet <T>();
         var c = new CollectionWrapper <T>((IList)a);
         var d = new CollectionWrapper <T>((ICollection <T>)a);
     });
 }
 private static void VerifyValueType(object value)
 {
     if (!CollectionWrapper <T> .IsCompatibleObject(value))
     {
         throw new ArgumentException("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.".FormatWith(CultureInfo.get_InvariantCulture(), new object[]
         {
             value,
             typeof(T)
         }), "value");
     }
 }
Exemplo n.º 13
0
 bool IList.Contains(object value)
 {
     if (CollectionWrapper <T> .IsCompatibleObject(value))
     {
         return(this.Contains((T)value));
     }
     else
     {
         return(false);
     }
 }
 int System.Collections.IList.IndexOf(object value)
 {
     if (this._genericCollection != null)
     {
         throw new Exception("Wrapped ICollection<T> does not support IndexOf.");
     }
     if (!CollectionWrapper <T> .IsCompatibleObject(value))
     {
         return(-1);
     }
     return(this._list.IndexOf((T)value));
 }
        object System.Collections.IList.this[int index]
        {
            get
            {
                if (this._genericCollection != null)
                {
                    throw new Exception("Wrapped ICollection<T> does not support indexer.");
                }
                return(this._list[index]);
            }
            set
            {
                if (this._genericCollection != null)
                {
                    throw new Exception("Wrapped ICollection<T> does not support indexer.");
                }
                CollectionWrapper <T> .VerifyValueType(value);

                this._list[index] = (T)value;
            }
        }
Exemplo n.º 16
0
 bool IList.Contains(object value) =>
 (CollectionWrapper <T> .IsCompatibleObject(value) && this.Contains((T)value));
Exemplo n.º 17
0
 // Token: 0x06000E64 RID: 3684 RVA: 0x00010EC1 File Offset: 0x0000F0C1
 bool IList.Contains(object value)
 {
     return(CollectionWrapper <T> .IsCompatibleObject(value) && this.Contains((T)((object)value)));
 }