Modifica

Condividi tramite


TimerEventSubscriptionCollection.GetEnumerator Method

Definition

Returns an enumerator that iterates through the TimerEventSubscriptionCollection.

public:
 virtual System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator

Returns

An IEnumerator for the TimerEventSubscriptionCollection.

Implements

Remarks

Access to the TimerEventSubscriptionCollection is synchronized; however, enumerating through a collection is intrinsically not a thread safe procedure. 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 its behavior is undefined. The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread safe procedure. To guarantee thread safety during enumeration, you can lock the TimerEventSubscriptionCollection during the entire enumeration by using SyncRoot.

Applies to