Add locking to EventWaitHandle.Set/Reset to avoid crashes when another thread dispose...
[mono.git] / mcs / class / corlib / System.Collections / CollectionBase.cs
index 7cda546e297c7392d7b372442ecc7b8b28cdba6f..75817380b13eb5d35b01001ee99ef8ef4382e114 100644 (file)
 //
 
 using System;
+using System.Runtime.InteropServices;
 
 namespace System.Collections {
 
+       [ComVisible(true)]
        [Serializable]
-       public abstract class CollectionBase : IList, ICollection, IEnumerable {
+#if INSIDE_CORLIB
+       public
+#else
+       internal
+#endif
+       abstract class CollectionBase : IList, ICollection, IEnumerable {
 
                // private instance properties
                private ArrayList list;
@@ -60,7 +67,30 @@ namespace System.Collections {
                }
                
                // Protected Instance Constructors
-               protected CollectionBase() { 
+               protected CollectionBase()
+               { 
+               }
+
+               protected CollectionBase (int capacity)
+               {
+                       list = new ArrayList (capacity);
+               }
+
+               [ComVisible (false)]
+               public int Capacity {
+                       get {
+                               if (list == null)
+                                       list = new ArrayList ();
+                               
+                               return list.Capacity;
+                       }
+
+                       set {
+                               if (list == null)
+                                       list = new ArrayList ();
+                                                             
+                               list.Capacity = value;
+                       }
                }
                
                // Protected Instance Properties