SortedDictionary<TKey,TValue>.ValueCollection.Enumerator.IEnumerator.Current 屬性


取得位於目前列舉值位置的項目。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; }
object? System.Collections.IEnumerator.Current { get; }
member this.System.Collections.IEnumerator.Current : obj
 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. MoveNext 必須呼叫方法,將列舉值前進到集合中的第一個元素,然後再讀取屬性的值 IEnumerator.CurrentThe 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.ResetIEnumerator.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.