Foley.Utilities.Collections
Interface ICollection2

Represents an enhanced version of the ICollection interface.

This class is an initial attempt to try to correct how Microsoft defines a collection. Some of the methods in IList really belong in ICollection, since all collections can share these methods and properties, from lists, to sets, to maps.

System.Collections.ICollection implementations fall into three categories: read-only, fixed-size, variable-size. A read-only System.Collections.ICollection cannot be modified. A fixed-size System.Collections.ICollection does not allow the addition or removal of elements, but it allows the modification of existing elements. A variable-size System.Collections.ICollection allows the addition, removal and modification of elements.

Property Summary
bool IsEmpty
         When implemented by a class, gets a value idicating whether the collection is empty or not.
bool IsFixedSize
         When implemented by a class, gets a value indicating whether the collection has a fixed size.
bool IsReadOnly
         When implemented by a class, gets a value indicating whether the collection is read-only.

Method Summary
void Clear()
         When implemented by a class, removes all items from the collection.


Property Detail

IsEmpty

public bool IsEmpty

When implemented by a class, gets a value idicating whether the collection is empty or not.

Value:
true if the collection contains no elements; otherwise, false.

IsFixedSize

public bool IsFixedSize

When implemented by a class, gets a value indicating whether the collection has a fixed size.

A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but it allows the modification of existing elements.

Value:
true if the collection has a fixed size; otherwise, false. The default should be false.

IsReadOnly

public bool IsReadOnly

When implemented by a class, gets a value indicating whether the collection is read-only.

A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.

Value:
true if the collection is read-only; otherwise, false. The default should be false.
Method Detail

Clear

public void Clear()

When implemented by a class, removes all items from the collection.

Implementations of this method can vary in how they handle the System.Collections.ICollection.Count and the capacity of a collection. Typically, the count is set to zero. The capacity can be set to zero or a default value, or it can remain unchanged.

Throws:
System.NotSupportedException - The collection is read-only.