TimerEventSubscriptionCollection.GetEnumerator 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回循环访问 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
返回
IEnumerator 的一个 TimerEventSubscriptionCollection。
实现
注解
已同步对 TimerEventSubscriptionCollection 的访问,但是,枚举整个集合本质上不是一个线程安全的过程。 只要集合保持不变,枚举器就仍有效。 如果对集合进行更改(如添加、修改或删除元素),则枚举数将失效且不可恢复,而且其行为是不确定的。 该枚举数不具有独占访问集合的权限;因此,枚举整个集合本质上不是一个线程安全的过程。 若要保证枚举过程中的线程安全,可通过使用 TimerEventSubscriptionCollection 在整个枚举过程中锁定 SyncRoot。