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
+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.
[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
[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;
}
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)
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);
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);