Add locking to EventWaitHandle.Set/Reset to avoid crashes when another thread dispose...
[mono.git] / mcs / class / corlib / System.Collections / ArrayList.cs
index f2f0962f095dc24d3905c79ee17bab8ee88d2de0..0a67c6a2c830e103b621716de866a21453f744e7 100644 (file)
@@ -30,29 +30,25 @@ using System.Diagnostics;
 
 namespace System.Collections 
 {
-#if NET_2_0
-       [ComVisible(true)]
-       [DebuggerDisplay ("Count={Count}")]
-#endif
        [Serializable]
 #if INSIDE_CORLIB
-       public
+       [ComVisible(true)]
+       [DebuggerDisplay ("Count={Count}")]
+       [DebuggerTypeProxy (typeof (CollectionDebuggerView))]
+       public class ArrayList : IList, ICloneable, ICollection, IEnumerable {
 #else
-       internal
+       internal class ArrayList : IList {
 #endif
-       class ArrayList
-               : IList, ICloneable, ICollection, IEnumerable 
-       {
                #region Enumerator
 
                private sealed class ArrayListEnumerator
                        : IEnumerator, ICloneable 
                {                       
+                       private object m_Current;
+                       private ArrayList m_List;
                        private int m_Pos;
                        private int m_Index;
                        private int m_Count;
-                       private object m_Current;
-                       private ArrayList m_List;
                        private int m_ExpectedStateChanges;
 
                        public ArrayListEnumerator(ArrayList list)
@@ -116,9 +112,9 @@ namespace System.Collections
                sealed class SimpleEnumerator : IEnumerator, ICloneable
                {
                        ArrayList list;
+                       object currentElement;
                        int index;
                        int version;
-                       object currentElement;
                        static object endFlag = new object ();
                                                        
                        public SimpleEnumerator (ArrayList list)
@@ -2497,30 +2493,24 @@ namespace System.Collections
 
                #region Fields
 
-#if NET_2_0
                private const int DefaultInitialCapacity = 4;
-#else
-               private const int DefaultInitialCapacity = 16;
-#endif
-               
-               /// <summary>
-               /// Number of items in the list.
-               /// </summary>
-               private int _size;
 
                /// <summary>
                /// Array to store the items.
                /// </summary>
                private object[] _items;
-               
+                               
+               /// <summary>
+               /// Number of items in the list.
+               /// </summary>
+               private int _size;
+
                /// <summary>
                /// Total number of state changes.
                /// </summary>
                private int _version;
 
-#if NET_2_0            
                private static readonly object [] EmptyArray = new object [0]; 
-#endif         
 
                #endregion
                
@@ -2532,11 +2522,7 @@ namespace System.Collections
                /// </summary>
                public ArrayList()
                {
-#if NET_2_0
                        _items = EmptyArray;
-#else
-                       _items = new object[DefaultInitialCapacity];
-#endif
                }               
 
                /// <summary>