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

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. MoveNext 必須先呼叫,才能將列舉值前移至集合的第一個元素,然後再讀取的值 EntryMoveNext 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.

給實施者的注意事項

Current繼承自的屬性會傳回 IEnumerator Object 已封裝的 DictionaryEntryThe 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.

適用於

另請參閱