IDictionaryEnumerator.Entry 屬性

定義

取得目前字典項目的索引鍵和值。Gets both the key and the value of the current dictionary entry.

public:
 property System::Collections::DictionaryEntry Entry { System::Collections::DictionaryEntry get(); };
public System.Collections.DictionaryEntry Entry { get; }
member this.Entry : System.Collections.DictionaryEntry
Public ReadOnly Property Entry As DictionaryEntry

屬性值

DictionaryEntry,含有目前字典元素的索引鍵和值。A DictionaryEntry containing both the key and the value of the current dictionary entry.

例外狀況

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

備註

在下列任一情況下,Entry 未定義:Entry 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. 在讀取 Entry的值之前,必須呼叫 MoveNext,將枚舉器前移至集合的第一個元素。MoveNext must be called to advance the enumerator to the first element of the collection before reading the value of Entry.

  • 最後一次呼叫 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.

Entry 會傳回相同的物件直到呼叫 MoveNextEntry returns the same object until MoveNext is called. MoveNext 會將 Entry 設定為下一個項目。MoveNext sets Entry to the next element.

給實施者的注意事項

繼承自 IEnumeratorCurrent 屬性會傳回屬於已裝箱 DictionaryEntryObjectThe Current property that is inherited from IEnumerator returns an Object that is a boxed DictionaryEntry. 它與 Entry 屬性相似,不同之處在于 Entry 會傳回 DictionaryEntry,而不是 ObjectIt is similar to the Entry property, except that Entry returns a DictionaryEntry rather than an Object.

適用於

另請參閱