Dictionary<TKey,TValue>.KeyCollection.Enumerator 结构

定义

Enumerates the elements of a Dictionary<TKey,TValue>.KeyCollection.

``public: value class Dictionary<TKey, TValue>::KeyCollection::Enumerator : System::Collections::Generic::IEnumerator<TKey>``
``public struct Dictionary<TKey,TValue>.KeyCollection.Enumerator : System.Collections.Generic.IEnumerator<TKey>``
``````[System.Serializable]
public struct Dictionary<TKey,TValue>.KeyCollection.Enumerator : System.Collections.Generic.IEnumerator<TKey>``````
``````type Dictionary<'Key, 'Value>.KeyCollection.Enumerator = struct
interface IEnumerator<'Key>
interface IEnumerator
interface IDisposable``````
``````[<System.Serializable>]
type Dictionary<'Key, 'Value>.KeyCollection.Enumerator = struct
interface IEnumerator<'Key>
interface IDisposable
interface IEnumerator``````
``````[<System.Serializable>]
type Dictionary<'Key, 'Value>.KeyCollection.Enumerator = struct
interface IEnumerator<'Key>
interface IEnumerator
interface IDisposable``````
``````Public Structure Dictionary(Of TKey, TValue).KeyCollection.Enumerator
Implements IEnumerator(Of TKey)``````

类型参数

TKey
TValue

Dictionary<TKey,TValue>.KeyCollection.Enumerator

注解

C `foreach` + + 中的 c # 语言 (的语句 `for each` `For Each` Visual Basic) 隐藏了枚举器的复杂性。The `foreach` statement of the C# language (`for each` in C++, `For Each` in Visual Basic) hides the complexity of enumerators. 因此，建议使用 `foreach`，而不是直接操作枚举数。Therefore, using `foreach` is recommended, instead of directly manipulating the enumerator.

属性

 获取枚举数当前位置的元素。Gets the element at the current position of the enumerator.

方法

 Releases all resources used by the Dictionary.KeyCollection.Enumerator. 使枚举数前进到 Dictionary.KeyCollection 的下一个元素。Advances the enumerator to the next element of the Dictionary.KeyCollection.

显式接口实现

 获取枚举数当前位置的元素。Gets the element at the current position of the enumerator. 将枚举数设置为其初始位置，该位置位于集合中第一个元素之前。Sets the enumerator to its initial position, which is before the first element in the collection.