From: Neale Date: Thu, 18 Apr 2013 15:31:47 +0000 (-0400) Subject: Reverse previous changes X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=191db41b36882368c6ae330ce5f36e42d023028c;p=mono.git Reverse previous changes --- diff --git a/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs b/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs index 6a57a75acba..b9d6a3e71e4 100644 --- a/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs +++ b/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs @@ -53,8 +53,7 @@ namespace System.Collections.ObjectModel , IReadOnlyList #endif { - IList items; - [field:NonSerializedAttribute()] + IList list; object syncRoot; public Collection () @@ -62,21 +61,21 @@ namespace System.Collections.ObjectModel List l = new List (); IList l2 = l as IList; syncRoot = l2.SyncRoot; - items = l; + list = l; } - public Collection (IList items) + public Collection (IList list) { - if (items == null) - throw new ArgumentNullException ("items"); - this.items = items; - ICollection l = items as ICollection; + if (list == null) + throw new ArgumentNullException ("list"); + this.list = list; + ICollection l = list as ICollection; syncRoot = (l != null) ? l.SyncRoot : new object (); } public void Add (T item) { - int idx = items.Count; + int idx = list.Count; InsertItem (idx, item); } @@ -87,27 +86,27 @@ namespace System.Collections.ObjectModel protected virtual void ClearItems () { - items.Clear (); + list.Clear (); } public bool Contains (T item) { - return items.Contains (item); + return list.Contains (item); } public void CopyTo (T [] array, int index) { - items.CopyTo (array, index); + list.CopyTo (array, index); } public IEnumerator GetEnumerator () { - return items.GetEnumerator (); + return list.GetEnumerator (); } public int IndexOf (T item) { - return items.IndexOf (item); + return list.IndexOf (item); } public void Insert (int index, T item) @@ -117,11 +116,11 @@ namespace System.Collections.ObjectModel protected virtual void InsertItem (int index, T item) { - items.Insert (index, item); + list.Insert (index, item); } protected IList Items { - get { return items; } + get { return list; } } public bool Remove (T item) @@ -142,25 +141,25 @@ namespace System.Collections.ObjectModel protected virtual void RemoveItem (int index) { - items.RemoveAt (index); + list.RemoveAt (index); } public int Count { - get { return items.Count; } + get { return list.Count; } } public T this [int index] { - get { return items [index]; } + get { return list [index]; } set { SetItem (index, value); } } bool ICollection.IsReadOnly { - get { return items.IsReadOnly; } + get { return list.IsReadOnly; } } protected virtual void SetItem (int index, T item) { - items[index] = item; + list[index] = item; } @@ -173,21 +172,21 @@ namespace System.Collections.ObjectModel throw new ArgumentException ("item"); } - internal static void CheckWritable (IList items) + internal static void CheckWritable (IList list) { - if (items.IsReadOnly) + if (list.IsReadOnly) throw new NotSupportedException (); } - internal static bool IsSynchronized (IList items) + internal static bool IsSynchronized (IList list) { - ICollection c = items as ICollection; + ICollection c = list as ICollection; return (c != null) ? c.IsSynchronized : false; } - internal static bool IsFixedSize (IList items) + internal static bool IsFixedSize (IList list) { - IList l = items as IList; + IList l = list as IList; return (l != null) ? l.IsFixedSize : false; } #endregion @@ -195,17 +194,17 @@ namespace System.Collections.ObjectModel #region Not generic interface implementations void ICollection.CopyTo (Array array, int index) { - ((ICollection)items).CopyTo (array, index); + ((ICollection)list).CopyTo (array, index); } IEnumerator IEnumerable.GetEnumerator () { - return (IEnumerator) items.GetEnumerator (); + return (IEnumerator) list.GetEnumerator (); } int IList.Add (object value) { - int idx = items.Count; + int idx = list.Count; InsertItem (idx, ConvertItem (value)); return idx; } @@ -213,14 +212,14 @@ namespace System.Collections.ObjectModel bool IList.Contains (object value) { if (CollectionHelpers.IsValidItem (value)) - return items.Contains ((T) value); + return list.Contains ((T) value); return false; } int IList.IndexOf (object value) { if (CollectionHelpers.IsValidItem (value)) - return items.IndexOf ((T) value); + return list.IndexOf ((T) value); return -1; } @@ -231,7 +230,7 @@ namespace System.Collections.ObjectModel void IList.Remove (object value) { - CheckWritable (items); + CheckWritable (list); int idx = IndexOf (ConvertItem (value)); @@ -239,22 +238,22 @@ namespace System.Collections.ObjectModel } bool ICollection.IsSynchronized { - get { return IsSynchronized (items); } + get { return IsSynchronized (list); } } object ICollection.SyncRoot { get { return syncRoot; } } bool IList.IsFixedSize { - get { return IsFixedSize (items); } + get { return IsFixedSize (list); } } bool IList.IsReadOnly { - get { return items.IsReadOnly; } + get { return list.IsReadOnly; } } object IList.this [int index] { - get { return items [index]; } + get { return list [index]; } set { SetItem (index, ConvertItem (value)); } } #endregion