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

属性值

同时包含当前字典项的键和值的 DictionaryEntryA 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.

注解

在下列任一情况下,不定义 EntryEntry 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 之前,MoveNext 返回相同的对象。Entry returns the same object until MoveNext is called. MoveNextEntry 设置为下一个元素。MoveNext sets Entry to the next element.

实施者说明

IEnumerator 继承的 Current 属性返回作为装箱 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.

适用于

另请参阅