ConcurrentBag<T>.GetEnumerator 方法

定义

返回循环访问 ConcurrentBag<T> 的枚举数。Returns an enumerator that iterates through the ConcurrentBag<T>.

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

返回

ConcurrentBag<T> 的内容的枚举器。An enumerator for the contents of the ConcurrentBag<T>.

实现

注解

枚举表示包内容的时间的快照。The enumeration represents a moment-in-time snapshot of the contents of the bag. 调用 GetEnumerator 后,它不会反映集合的任何更新。It does not reflect any updates to the collection after GetEnumerator was called. 枚举器可以安全地与包的读取和写入操作一起使用。The enumerator is safe to use concurrently with reads from and writes to the bag.

适用于

另请参阅