using System; using System.Collections.Generic; using System.Runtime.InteropServices; namespace System.Collections.ObjectModel { /// Provides the base class for a generic collection. /// The type of elements in the collection. // Token: 0x02000110 RID: 272 [ComVisible(false)] [Serializable] public class Collection : IEnumerable, ICollection, IList, ICollection, IList, IEnumerable { /// Initializes a new instance of the class that is empty. // Token: 0x06000D65 RID: 3429 RVA: 0x0003B278 File Offset: 0x00039478 public Collection() { List list = new List(); IList list2 = list; this.syncRoot = list2.SyncRoot; this.list = list; } /// Initializes a new instance of the class as a wrapper for the specified list. /// The list that is wrapped by the new collection. /// /// is null. // Token: 0x06000D66 RID: 3430 RVA: 0x0003B2A8 File Offset: 0x000394A8 public Collection(IList list) { if (list == null) { throw new ArgumentNullException("list"); } this.list = list; ICollection collection = list as ICollection; this.syncRoot = ((collection == null) ? new object() : collection.SyncRoot); } // Token: 0x170001FF RID: 511 // (get) Token: 0x06000D67 RID: 3431 RVA: 0x0003B2F8 File Offset: 0x000394F8 bool ICollection.IsReadOnly { get { return this.list.IsReadOnly; } } /// Copies the elements of the to an , starting at a particular index. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// /// is multidimensional.-or- does not have zero-based indexing.-or-The number of elements in the source is greater than the available space from to the end of the destination .-or-The type of the source cannot be cast automatically to the type of the destination . // Token: 0x06000D68 RID: 3432 RVA: 0x0003B308 File Offset: 0x00039508 void ICollection.CopyTo(Array array, int index) { ((ICollection)this.list).CopyTo(array, index); } /// Returns an enumerator that iterates through a collection. /// An that can be used to iterate through the collection. // Token: 0x06000D69 RID: 3433 RVA: 0x0003B31C File Offset: 0x0003951C IEnumerator IEnumerable.GetEnumerator() { return this.list.GetEnumerator(); } /// Adds an item to the . /// The position into which the new element was inserted. /// The to add to the . /// /// is of a type that is not assignable to the . // Token: 0x06000D6A RID: 3434 RVA: 0x0003B32C File Offset: 0x0003952C int IList.Add(object value) { int count = this.list.Count; this.InsertItem(count, Collection.ConvertItem(value)); return count; } /// Determines whether the contains a specific value. /// true if the is found in the ; otherwise, false. /// The to locate in the . /// /// is of a type that is not assignable to the . // Token: 0x06000D6B RID: 3435 RVA: 0x0003B354 File Offset: 0x00039554 bool IList.Contains(object value) { return Collection.IsValidItem(value) && this.list.Contains((T)((object)value)); } /// Determines the index of a specific item in the . /// The index of if found in the list; otherwise, -1. /// The to locate in the . /// /// is of a type that is not assignable to the . // Token: 0x06000D6C RID: 3436 RVA: 0x0003B374 File Offset: 0x00039574 int IList.IndexOf(object value) { if (Collection.IsValidItem(value)) { return this.list.IndexOf((T)((object)value)); } return -1; } /// Inserts an item into the at the specified index. /// The zero-based index at which should be inserted. /// The to insert into the . /// /// is not a valid index in the . /// /// is of a type that is not assignable to the . // Token: 0x06000D6D RID: 3437 RVA: 0x0003B394 File Offset: 0x00039594 void IList.Insert(int index, object value) { this.InsertItem(index, Collection.ConvertItem(value)); } /// Removes the first occurrence of a specific object from the . /// The to remove from the . /// /// is of a type that is not assignable to the . // Token: 0x06000D6E RID: 3438 RVA: 0x0003B3A4 File Offset: 0x000395A4 void IList.Remove(object value) { Collection.CheckWritable(this.list); int num = this.IndexOf(Collection.ConvertItem(value)); this.RemoveItem(num); } /// Gets a value indicating whether access to the is synchronized (thread safe). /// true if access to the is synchronized (thread safe); otherwise, false. In the default implementation of , this property always returns false. // Token: 0x17000200 RID: 512 // (get) Token: 0x06000D6F RID: 3439 RVA: 0x0003B3D0 File Offset: 0x000395D0 bool ICollection.IsSynchronized { get { return Collection.IsSynchronized(this.list); } } /// Gets an object that can be used to synchronize access to the . /// An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance. // Token: 0x17000201 RID: 513 // (get) Token: 0x06000D70 RID: 3440 RVA: 0x0003B3E0 File Offset: 0x000395E0 object ICollection.SyncRoot { get { return this.syncRoot; } } /// Gets a value indicating whether the has a fixed size. /// true if the has a fixed size; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x17000202 RID: 514 // (get) Token: 0x06000D71 RID: 3441 RVA: 0x0003B3E8 File Offset: 0x000395E8 bool IList.IsFixedSize { get { return Collection.IsFixedSize(this.list); } } /// Gets a value indicating whether the is read-only. /// true if the is read-only; otherwise, false. In the default implementation of , this property always returns false. // Token: 0x17000203 RID: 515 // (get) Token: 0x06000D72 RID: 3442 RVA: 0x0003B3F8 File Offset: 0x000395F8 bool IList.IsReadOnly { get { return this.list.IsReadOnly; } } /// Gets or sets the element at the specified index. /// The element at the specified index. /// The zero-based index of the element to get or set. /// /// is not a valid index in the . /// The property is set, and is of a type that is not assignable to the . // Token: 0x17000204 RID: 516 object IList.this[int index] { get { return this.list[index]; } set { this.SetItem(index, Collection.ConvertItem(value)); } } /// Adds an object to the end of the . /// The object to be added to the end of the . The value can be null for reference types. // Token: 0x06000D75 RID: 3445 RVA: 0x0003B42C File Offset: 0x0003962C public void Add(T item) { int count = this.list.Count; this.InsertItem(count, item); } /// Removes all elements from the . // Token: 0x06000D76 RID: 3446 RVA: 0x0003B450 File Offset: 0x00039650 public void Clear() { this.ClearItems(); } /// Removes all elements from the . // Token: 0x06000D77 RID: 3447 RVA: 0x0003B458 File Offset: 0x00039658 protected virtual void ClearItems() { this.list.Clear(); } /// Determines whether an element is in the . /// true if is found in the ; otherwise, false. /// The object to locate in the . The value can be null for reference types. // Token: 0x06000D78 RID: 3448 RVA: 0x0003B468 File Offset: 0x00039668 public bool Contains(T item) { return this.list.Contains(item); } /// Copies the entire to a compatible one-dimensional , starting at the specified index of the target array. /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. /// The zero-based index in at which copying begins. /// /// is null. /// /// is less than zero. /// The number of elements in the source is greater than the available space from to the end of the destination . // Token: 0x06000D79 RID: 3449 RVA: 0x0003B478 File Offset: 0x00039678 public void CopyTo(T[] array, int index) { this.list.CopyTo(array, index); } /// Returns an enumerator that iterates through the . /// An for the . // Token: 0x06000D7A RID: 3450 RVA: 0x0003B488 File Offset: 0x00039688 public IEnumerator GetEnumerator() { return this.list.GetEnumerator(); } /// Searches for the specified object and returns the zero-based index of the first occurrence within the entire . /// The zero-based index of the first occurrence of within the entire , if found; otherwise, -1. /// The object to locate in the . The value can be null for reference types. // Token: 0x06000D7B RID: 3451 RVA: 0x0003B498 File Offset: 0x00039698 public int IndexOf(T item) { return this.list.IndexOf(item); } /// Inserts an element into the at the specified index. /// The zero-based index at which should be inserted. /// The object to insert. The value can be null for reference types. /// /// is less than zero.-or- is greater than . // Token: 0x06000D7C RID: 3452 RVA: 0x0003B4A8 File Offset: 0x000396A8 public void Insert(int index, T item) { this.InsertItem(index, item); } /// Inserts an element into the at the specified index. /// The zero-based index at which should be inserted. /// The object to insert. The value can be null for reference types. /// /// is less than zero.-or- is greater than . // Token: 0x06000D7D RID: 3453 RVA: 0x0003B4B4 File Offset: 0x000396B4 protected virtual void InsertItem(int index, T item) { this.list.Insert(index, item); } /// Gets a wrapper around the . /// A wrapper around the . // Token: 0x17000205 RID: 517 // (get) Token: 0x06000D7E RID: 3454 RVA: 0x0003B4C4 File Offset: 0x000396C4 protected IList Items { get { return this.list; } } /// Removes the first occurrence of a specific object from the . /// true if is successfully removed; otherwise, false. This method also returns false if was not found in the original . /// The object to remove from the . The value can be null for reference types. // Token: 0x06000D7F RID: 3455 RVA: 0x0003B4CC File Offset: 0x000396CC public bool Remove(T item) { int num = this.IndexOf(item); if (num == -1) { return false; } this.RemoveItem(num); return true; } /// Removes the element at the specified index of the . /// The zero-based index of the element to remove. /// /// is less than zero.-or- is equal to or greater than . // Token: 0x06000D80 RID: 3456 RVA: 0x0003B4F4 File Offset: 0x000396F4 public void RemoveAt(int index) { this.RemoveItem(index); } /// Removes the element at the specified index of the . /// The zero-based index of the element to remove. /// /// is less than zero.-or- is equal to or greater than . // Token: 0x06000D81 RID: 3457 RVA: 0x0003B500 File Offset: 0x00039700 protected virtual void RemoveItem(int index) { this.list.RemoveAt(index); } /// Gets the number of elements actually contained in the . /// The number of elements actually contained in the . // Token: 0x17000206 RID: 518 // (get) Token: 0x06000D82 RID: 3458 RVA: 0x0003B510 File Offset: 0x00039710 public int Count { get { return this.list.Count; } } /// Gets or sets the element at the specified index. /// The element at the specified index. /// The zero-based index of the element to get or set. /// /// is less than zero.-or- is equal to or greater than . // Token: 0x17000207 RID: 519 public T this[int index] { get { return this.list[index]; } set { this.SetItem(index, value); } } /// Replaces the element at the specified index. /// The zero-based index of the element to replace. /// The new value for the element at the specified index. The value can be null for reference types. /// /// is less than zero.-or- is greater than . // Token: 0x06000D85 RID: 3461 RVA: 0x0003B53C File Offset: 0x0003973C protected virtual void SetItem(int index, T item) { this.list[index] = item; } // Token: 0x06000D86 RID: 3462 RVA: 0x0003B54C File Offset: 0x0003974C internal static bool IsValidItem(object item) { return item is T || (item == null && !typeof(T).IsValueType); } // Token: 0x06000D87 RID: 3463 RVA: 0x0003B578 File Offset: 0x00039778 internal static T ConvertItem(object item) { if (Collection.IsValidItem(item)) { return (T)((object)item); } throw new ArgumentException("item"); } // Token: 0x06000D88 RID: 3464 RVA: 0x0003B598 File Offset: 0x00039798 internal static void CheckWritable(IList list) { if (list.IsReadOnly) { throw new NotSupportedException(); } } // Token: 0x06000D89 RID: 3465 RVA: 0x0003B5AC File Offset: 0x000397AC internal static bool IsSynchronized(IList list) { ICollection collection = list as ICollection; return collection != null && collection.IsSynchronized; } // Token: 0x06000D8A RID: 3466 RVA: 0x0003B5D4 File Offset: 0x000397D4 internal static bool IsFixedSize(IList list) { IList list2 = list as IList; return list2 != null && list2.IsFixedSize; } // Token: 0x04000387 RID: 903 private IList list; // Token: 0x04000388 RID: 904 private object syncRoot; } }