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

定義

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

public:
 property TValue Current { TValue get(); };
public TValue Current { get; }
member this.Current : 'Value
Public ReadOnly Property Current As TValue

屬性值

TValue

SortedDictionary<TKey,TValue>.ValueCollection 中位於目前列舉值位置的項目。The element in the SortedDictionary<TKey,TValue>.ValueCollection at the current position of the enumerator.

實作

備註

Current 在下列任何情況下都未定義: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 必須呼叫方法,將列舉值前進到集合中的第一個元素,然後再讀取屬性的值 CurrentThe MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the 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.

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

適用於

另請參閱