Mega Code Archive
0344 ICollection and IList Interfaces
The functionalities of ICollection, IList and IEnuerable are listed in the following table.
Interfaces Functionalities
IEnumerable (and IEnumerable) Enumerable
ICollection (and ICollection) Countable
IList /IDictionary and their nongeneric versions Accessible by index/key
interface ICollection is defined as follows:
public interface ICollection : IEnumerable, IEnumerable
{
int Count { get; }
bool Contains (T item);
void CopyTo (T[] array, int arrayIndex);
bool IsReadOnly { get; }
void Add(T item);
bool Remove (T item);
void Clear();
}
The nongeneric ICollection is similar in providing a countable collection:
public interface ICollection : IEnumerable
{
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo (Array array, int index);
}