Επεξεργασία

Κοινή χρήση μέσω


CaptureCollection.IEnumerable<Capture>.GetEnumerator Method

Definition

Returns an enumerator that iterates through the collection.

 virtual System::Collections::Generic::IEnumerator<System::Text::RegularExpressions::Capture ^> ^ System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Capture>.GetEnumerator() = System::Collections::Generic::IEnumerable<System::Text::RegularExpressions::Capture ^>::GetEnumerator;
System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Capture> IEnumerable<Capture>.GetEnumerator ();
abstract member System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Capture>.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Capture>
override this.System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Capture>.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Capture>
Function GetEnumerator () As IEnumerator(Of Capture) Implements IEnumerable(Of Capture).GetEnumerator

Returns

An enumerator that can be used to iterate through the collection.

Implements

Remarks

The returned IEnumerator<T> provides the ability to iterate through the collection by exposing a Current property .You can use enumerators to read the data in a collection, but not to modify the collection. Initially, the enumerator is positioned before the first element in the collection. At this position, Current is undefined. Therefore, you must call the MoveNext method to advance the enumerator to the first element of the collection before reading the value of Current. Current returns the same object until MoveNext is called again as MoveNext sets Current to the next element. If MoveNext passes the end of the collection, the enumerator is positioned after the last element in the collection and MoveNext returns false. When the enumerator is at this position, subsequent calls to MoveNext also return false. If the last call to MoveNext returned false, Current is undefined. You cannot set Current to the first element of the collection again; you must create a new enumerator instance instead. If changes are made to the collection, such as adding, modifying, or deleting elements, the behavior of the enumerator is undefined. An enumerator does not have exclusive access to the collection so 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 invalidated and you may get unexpected results. Also, enumerating a collection is not a thread-safe procedure. To guarantee thread-safety, you should lock the collection during enumerator or implement synchronization on the collection. Default implementations of collections in the System.Collections.Generic namespace aren't synchronized.

Applies to