Foley.Utilities.Collections
Class Collection2Base

Provides an abstract implementation of the Foley.Utilities.Collections.ICollection2 interface.

The main purpose of this is an all purpose base class that can be extended by any class that wants to be a collection.

Constructor Summary
Collection2Base()
         Protected constructor for abstract class.

Property Summary
int Count
         When implemented by a class, gets the number of elements contained in the collection.
bool IsEmpty
         Gets a boolean value idicating whether the collection is empty or not.
bool IsFixedSize
         Gets a boolean value indicating whether the collection has a fixed size.
bool IsReadOnly
         Gets a boolean value indicating whether the collection is read-only.
bool IsSynchronized
         Gets a boolean value indicating whether access to the collection is synchronized (thread-safe).
object SyncRoot
         Gets an System.Object that can be used to synchronize access to the collection.

Method Summary
void Clear()
         Removes all elements from the collection.
void CopyTo(System.Array array, int index)
         Copies the entire collection to a compatible one-dimensional System.Array, starting at the specified index of the target array.
System.Collections.IEnumerator GetEnumerator()
         When implemented by a class, returns an System.Collections.IEnumerator for the entire collection.
bool IsContainedIn(System.Collections.ICollection collection, object value)
         Determins if the specified value is contained in the specified collection.

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Constructor Detail

Collection2Base

protected Collection2Base()

Protected constructor for abstract class.

Property Detail

Count

public int Count

When implemented by a class, gets the number of elements contained in the collection.

Value:
The number of elements actually contained in the collection.

IsEmpty

public bool IsEmpty

Gets a boolean value idicating whether the collection is empty or not.

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

IsFixedSize

public bool IsFixedSize

Gets a boolean value indicating whether the collection has a fixed size.

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

IsReadOnly

public bool IsReadOnly

Gets a boolean value indicating whether the collection is read-only.

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

IsSynchronized

public bool IsSynchronized

Gets a boolean value indicating whether access to the collection is synchronized (thread-safe).

Value:
true if access to the collection is synchronized (thread-safe); otherwise, false. The default is false.

SyncRoot

public object SyncRoot

Gets an System.Object that can be used to synchronize access to the collection.

Value:
An System.Object that can be used to synchronize access to the collection.
Method Detail

Clear

public void Clear()

Removes all elements from the collection.


CopyTo

public void CopyTo(System.Array array,
                   int index)

Copies the entire collection to a compatible one-dimensional System.Array, starting at the specified index of the target array.

Parameters:
array - The one-dimensional System.Array that is the destination of the elementscopied from the collection. The System.Array must have zero-based indexing.
index - The zero-based index in array at which copying begins.
Throws:
System.ArgumentNullException - The array is a null reference (Nothing in Visual Basic).
System.ArgumentOutOfRangeException - The index is less than zero.
System.ArgumentException - The array is multidimensional. -or- The index is equal to or greater than the length of array. -or- The number of elements in the collection is greater than the available space from index to the end of the destination array.

GetEnumerator

public System.Collections.IEnumerator GetEnumerator()

When implemented by a class, returns an System.Collections.IEnumerator for the entire collection.

Returns:
An System.Collections.IEnumerator for the entire collection.

IsContainedIn

protected bool IsContainedIn(System.Collections.ICollection collection,
                             object value)

Determins if the specified value is contained in the specified collection.

Parameters:
collection - The System.Collections.ICollection used to test the specified System.Object against.
value - The System.Object used to see if it is contained in the specified System.Collections.ICollection.
Returns:
true if value is contained in collection; otherwise false