public class ComponentCollection : ReadOnlyCollectionBase
|
ctor #1 | Initializes a new instance of the ComponentCollection class with an array of components. |
Count (inherited from System.Collections.ReadOnlyCollectionBase) |
Read-only See base class member description: System.Collections.ReadOnlyCollectionBase.Count Gets the number of elements contained in the ReadOnlyCollectionBase instance. |
Item | Read-only Overloaded: Item[string name] {get Gets a specific Component in the Container. |
Item | Read-only Overloaded: Item[int index] {get Gets a specific Component in the Container. |
CopyTo | Copies the entire collection to an array, starting at the specified index. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetEnumerator (inherited from System.Collections.ReadOnlyCollectionBase) |
See base class member description: System.Collections.ReadOnlyCollectionBase.GetEnumerator Returns an enumerator that can iterate through the ReadOnlyCollectionBase instance. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
InnerList (inherited from System.Collections.ReadOnlyCollectionBase) |
Read-only See base class member description: System.Collections.ReadOnlyCollectionBase.InnerList Gets the list of elements contained in the ReadOnlyCollectionBase instance. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public ComponentCollection( |
components
public int Count {get;}
|
protected ArrayList InnerList {get;}
|
public virtual IComponent this[string name] {get;}
|
name
public virtual IComponent this[int index] {get;}
|
index
public void CopyTo( |
array
index
~ComponentCollection(); |
public IEnumerator GetEnumerator(); |
Initially, the enumerator is positioned before the first element in the collection. IEnumerator.Reset also brings the enumerator back to this position. At this position, calling IEnumerator.Current throws an exception. Therefore, you must call IEnumerator.MoveNext to advance the enumerator to the first element of the collection before reading the value of IEnumerator.Current.
IEnumerator.Current returns the same object until either IEnumerator.MoveNext or IEnumerator.Reset is called. IEnumerator.MoveNext sets IEnumerator.Current to the next element.
After the end of the collection is passed, the enumerator is positioned after the last element in the collection, and calling IEnumerator.MoveNext returns false. If the last call to IEnumerator.MoveNext returned false, calling IEnumerator.Current throws an exception. To set IEnumerator.Current to the first element of the collection again, you can call IEnumerator.Reset followed by IEnumerator.MoveNext.
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying or deleting elements, the enumerator is irrecoverably invalidated and the next call to IEnumerator.MoveNext or IEnumerator.Reset throws an InvalidOperationException. If the collection is modified between IEnumerator.MoveNext and IEnumerator.Current, IEnumerator.Current will return the element that it is set to, even if the enumerator is already invalidated.
The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |