Queue<T>.Enumerator.IEnumerator.Reset 方法

定義

將列舉值設定為其初始位置,在集合的第一個元素之前。Sets the enumerator to its initial position, which is before the first element in the collection.

 virtual void System.Collections.IEnumerator.Reset() = System::Collections::IEnumerator::Reset;
void IEnumerator.Reset ();
abstract member System.Collections.IEnumerator.Reset : unit -> unit
override this.System.Collections.IEnumerator.Reset : unit -> unit
Sub Reset () Implements IEnumerator.Reset

實作

例外狀況

建立列舉值之後,集合已修改。The collection was modified after the enumerator was created.

備註

只要集合維持不變,列舉值就仍維持有效。An enumerator remains valid as long as the collection remains unchanged. 如果對集合進行了變更,例如加入、修改或刪除專案,枚舉器會失效,且下一次呼叫 MoveNextIEnumerator.Reset 會擲回 InvalidOperationExceptionIf changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to MoveNext or IEnumerator.Reset throws an InvalidOperationException.

適用於

另請參閱