IDictionaryEnumerator.Value 屬性


取得目前字典項目的值。Gets the value of the current dictionary entry.

 property System::Object ^ Value { System::Object ^ get(); };
public object Value { get; }
member this.Value : obj
Public ReadOnly Property Value As Object


列舉型別目前元素的值。The value of the current element of the enumeration.


IDictionaryEnumerator 位於字典的第一個元素之前,或最後一個元素之後。The IDictionaryEnumerator is positioned before the first entry of the dictionary or after the last entry.


在下列任一情況下,Value 未定義:Value is undefined under any of the following conditions:

  • 枚舉器位於集合中的第一個元素之前,緊接在建立枚舉器之後。The enumerator is positioned before the first element in the collection, immediately after the enumerator is created. 在讀取 Value的值之前,必須呼叫 MoveNext,將枚舉器前移至集合的第一個元素。MoveNext must be called to advance the enumerator to the first element of the collection before reading the value of Value.

  • 最後一次呼叫 MoveNext 傳回 false,表示集合的結尾。The last call to MoveNext returned false, which indicates the end of the collection.

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

Value 會傳回相同的物件直到呼叫 MoveNextValue returns the same object until MoveNext is called. MoveNextValue 設定為列舉中下一個元素的值。MoveNext sets Value to the value of the next element in enumeration.