Dictionary<TKey,TValue>.Enumerator.IDictionaryEnumerator.Entry 属性


获取枚举数当前位置的元素。Gets the element at the current position of the enumerator.

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



字典中位于枚举数当前位置的元素,如 DictionaryEntryThe element in the dictionary at the current position of the enumerator, as a DictionaryEntry.



枚举器位于集合中第一个元素之前或最后一个元素之后。The enumerator is positioned before the first element of the collection or after the last element.


IDictionaryEnumerator.Entry 在以下任何条件下均未定义:IDictionaryEnumerator.Entry 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 读取属性的值之前,必须调用方法以将枚举数前移到集合的第一个元素 IDictionaryEnumerator.EntryThe MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the IDictionaryEnumerator.Entry 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.

IDictionaryEnumerator.Entry 不移动枚举器的位置,并且连续调用将 IDictionaryEnumerator.Entry 返回相同的对象,直到 MoveNext IEnumerator.Reset 调用或。IDictionaryEnumerator.Entry does not move the position of the enumerator, and consecutive calls to IDictionaryEnumerator.Entry return the same object until either MoveNext or IEnumerator.Reset is called.