2004-08-02 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Mon, 2 Aug 2004 20:54:35 +0000 (20:54 -0000)
committerMartin Baulig <martin@novell.com>
Mon, 2 Aug 2004 20:54:35 +0000 (20:54 -0000)
Started to do some API review.

* ICollection.cs (ICollection<T>): Added IsReadOnly, Add, Clear,
Contains and Remove.

* IList.cs (IList<T>): Removed Add, Clear, Constains, Remove,
IsReadOnly and IsFixedSize.

svn path=/trunk/mcs/; revision=31749

mcs/class/corlib/System.Collections.Generic/ChangeLog
mcs/class/corlib/System.Collections.Generic/ICollection.cs
mcs/class/corlib/System.Collections.Generic/IList.cs
mcs/class/corlib/System.Collections.Generic/List.cs
mcs/class/corlib/System.Collections.Generic/Queue.cs
mcs/class/corlib/System.Collections.Generic/Stack.cs

index d5de27c5f95ecf3582d57baf288410b10af05bd5..6081ee6ad8dbc02cebbacc7e794639d4af390191 100644 (file)
@@ -1,3 +1,13 @@
+2004-08-02  Martin Baulig  <martin@ximian.com>
+
+       Started to do some API review.
+
+       * ICollection.cs (ICollection<T>): Added IsReadOnly, Add, Clear,
+       Contains and Remove.
+
+       * IList.cs (IList<T>): Removed Add, Clear, Constains, Remove,
+       IsReadOnly and IsFixedSize.
+
 2004-08-02  Martin Baulig  <martin@ximian.com>
 
        * IList.cs (IList.Add): Changed return type to void.
index db0e853d505b70e5f89c3a7b39c32190971065c2..63e2d876af609171f9e12550fc5fa052e5944e50 100644 (file)
@@ -41,11 +41,23 @@ namespace System.Collections.Generic
        [ComVisible(false)]
        public interface ICollection<T> : IEnumerable<T>
        {
-               void CopyTo (T[] array, int arrayIndex);
-
                int Count {
                        get;
                }
+
+               bool IsReadOnly {
+                       get;
+               }
+
+               void Add (T item);
+
+               void Clear ();
+
+               bool Contains (T item);
+
+               void CopyTo (T[] array, int arrayIndex);
+
+               bool Remove (T item);
        }
 }
 #endif
index 32325c1a1e08abaeb66e905b4b463668e939fb0e..1023d41882a73c80bd10e544f5603035cd2f0ae1 100644 (file)
@@ -41,28 +41,12 @@ namespace System.Collections.Generic
        [ComVisible(false)]
        public interface IList<T> : ICollection<T>
        {
-               void Add (T item);
-
-               void Clear ();
-
-               bool Contains (T item);
-
                int IndexOf (T item);
 
                void Insert (int index, T item);
 
-               void Remove (T item);
-
                void RemoveAt (int index);
 
-               bool IsFixedSize {
-                       get;
-               }
-
-               bool IsReadOnly {
-                       get;
-               }
-
                T this [int switchName] {
                        get; set;
                }
index 2e0c451393429907b5825d2fe34acef9c945dbfe..3ed85ed65fbfb8884ce28384ea0c0a79720e8a44 100644 (file)
@@ -152,11 +152,14 @@ namespace System.Collections.Generic
                        Insert (index, (T) item);
                }
 
-               public void Remove (T item)
+               public bool Remove (T item)
                {
                        int index = IndexOf (item);
-                       if (index >= 0)
-                               RemoveAt (index);
+                       if (index < 0)
+                               return false;
+
+                       RemoveAt (index);
+                       return true;
                }
 
                void IList.Remove (object item)
index 87656f731df38ad8efac3074b25217cf37471b9c..cddcf8290bae0672bae09ec4e6feb20ed18900e6 100644 (file)
@@ -139,6 +139,20 @@ namespace System.Collections.Generic
                        get { return this; }
                }
 
+               public bool IsReadOnly {
+                       get { return false; }
+               }
+
+               public void Add (T item)
+               {
+                       Enqueue (item);
+               }
+
+               public bool Remove (T item)
+               {
+                       throw new NotImplementedException ();
+               }
+
                public IEnumerator<T> GetEnumerator ()
                {
                        return new Enumerator (this);
index 75255f4e1169e777d52416716ea887e8e8c3c412..ab029fe0ed21635e6388b60d2fc74bfe9d02c5ac 100644 (file)
@@ -137,6 +137,20 @@ namespace System.Collections.Generic
                        get { return this; }
                }
 
+               public bool IsReadOnly {
+                       get { return false; }
+               }
+
+               public void Add (T item)
+               {
+                       Push (item);
+               }
+
+               public bool Remove (T item)
+               {
+                       throw new NotImplementedException ();
+               }
+
                public IEnumerator<T> GetEnumerator ()
                {
                        return new Enumerator (this);