ConcurrentDictionary<TKey,TValue>.GetEnumerator Method

Definition

返回遍历 ConcurrentDictionary<TKey,TValue> 的枚举器。Returns an enumerator that iterates through the ConcurrentDictionary<TKey,TValue>.

public:
 virtual System::Collections::Generic::IEnumerator<System::Collections::Generic::KeyValuePair<TKey, TValue>> ^ GetEnumerator();
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey,TValue>> GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<'Key, 'Value>>
override this.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<'Key, 'Value>>
Public Function GetEnumerator () As IEnumerator(Of KeyValuePair(Of TKey, TValue))
Public Iterator Overridable NotOverridable Function GetEnumerator () As IEnumerator(Of KeyValuePair(Of TKey, TValue))

Returns

IEnumerator<KeyValuePair<TKey,TValue>>

用于 ConcurrentDictionary<TKey,TValue> 的枚举数。An enumerator for the ConcurrentDictionary<TKey,TValue>.

Implements

Remarks

从字典返回的枚举器可安全地用于字典中的读取和写入,但它并不表示字典的时间点快照。The enumerator returned from the dictionary is safe to use concurrently with reads and writes to the dictionary, however it does not represent a moment-in-time snapshot of the dictionary. 通过枚举器公开的内容可能包含调用 GetEnumerator 后对字典所做的修改。The contents exposed through the enumerator may contain modifications made to the dictionary after GetEnumerator was called.

Applies to

See also