# Queue<T>.Enumerator 结构

## 定义

``public: value class Queue<T>::Enumerator : System::Collections::Generic::IEnumerator<T>``
``public struct Queue<T>.Enumerator : System.Collections.Generic.IEnumerator<T>``
``````[System.Serializable]
public struct Queue<T>.Enumerator : System.Collections.Generic.IEnumerator<T>``````
``````type Queue<'T>.Enumerator = struct
interface IEnumerator<'T>
interface IEnumerator
interface IDisposable``````
``````type Queue<'T>.Enumerator = struct
interface IEnumerator<'T>
interface IDisposable
interface IEnumerator``````
``````Public Structure Queue(Of T).Enumerator
Implements IEnumerator(Of T)``````

#### 类型参数

T

Queue<T>.Enumerator

## 注解

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

## 属性

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

## 方法

 释放由 Queue.Enumerator 使用的所有资源。Releases all resources used by the Queue.Enumerator. 使枚举数前进到 Queue 的下一个元素。Advances the enumerator to the next element of the Queue.

## 显式接口实现

 获取枚举数当前位置的元素。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.