LinkedList<T>.Enumerator.IEnumerator.Current LinkedList<T>.Enumerator.IEnumerator.Current LinkedList<T>.Enumerator.IEnumerator.Current Property

定義

取得位於目前列舉值位置的項目。Gets the element at the current position of the enumerator.

property System::Object ^ System::Collections::IEnumerator::Current { System::Object ^ get(); };
object System.Collections.IEnumerator.Current { get; }
 ReadOnly Property Current As Object Implements IEnumerator.Current

屬性值

位於列舉值中目前位置的集合中的元素。The element in the collection at the current position of the enumerator.

實作

例外狀況

列舉值是放在集合的第一個項目之前,或最後一個項目之後。The enumerator is positioned before the first element of the collection or after the last element.

備註

IEnumerator.Current在下列任一情況下都未定義:IEnumerator.Current is undefined under any of the following conditions:

  • 枚舉器位於集合的第一個元素之前。The enumerator is positioned before the first element of the collection. 這會在建立枚舉器之後, 或在IEnumerator.Reset呼叫方法之後發生。That happens after an enumerator is created or after the IEnumerator.Reset method is called. 您必須呼叫IEnumerator.Current 方法,將列舉值前移至集合的第一個元素,然後再讀取MoveNext屬性的值。The MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the IEnumerator.Current property.

  • 最後一個呼叫MoveNext會傳回false, 這表示集合的結尾, 而枚舉器位於集合的最後一個元素之後。The last call to MoveNext returned false, which indicates the end of the collection and that the enumerator is positioned after the last element of the collection.

  • 因為集合中所做的變更, 例如新增、修改或刪除元素, 所以列舉值會無效。The enumerator is invalidated due to changes made in the collection, such as adding, modifying, or deleting elements.

IEnumerator.Current不會移動列舉值的位置, 而連續的呼叫IEnumerator.Current會傳回相同的物件, MoveNext直到呼叫IEnumerator.Reset或為止。IEnumerator.Current does not move the position of the enumerator, and consecutive calls to IEnumerator.Current return the same object until either MoveNext or IEnumerator.Reset is called.

適用於

另請參閱