Wintellect.PowerCollections Namespace
Algorithms Class
GhostDoc Pro Sample Help File

Bag<(Of <(<'T>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the items in the bag. If an item is present multiple times in the bag, the representative item is yielded by the enumerator multiple times. The order of enumeration is haphazard and may change.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An enumerator for enumerating all the items in the Bag.

Remarks


Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.

If an item is added to or deleted from the bag while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumeration all the items in the bag takes time O(N), where N is the number of items in the bag.