SortedDictionary<TKey,TValue>.ValueCollection.Enumerator.IEnumerator.Current 属性
定义
获取枚举数当前位置的元素。Gets the element at the current position of the enumerator.
property System::Object ^ System::Collections::IEnumerator::Current { System::Object ^ get(); };
object System.Collections.IEnumerator.Current { get; }
object? System.Collections.IEnumerator.Current { get; }
member this.System.Collections.IEnumerator.Current : obj
ReadOnly Property Current As Object Implements IEnumerator.Current
属性值
集合中位于枚举数当前位置的元素。The element in the collection at the current position of the enumerator.
实现
例外
枚举器位于集合中第一个元素之前或最后一个元素之后。The enumerator is positioned before the first element of the collection or after the last element.
注解
IEnumerator.Current 在以下任何条件下均未定义:IEnumerator.Current 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 读取属性的值之前,必须调用方法以将枚举数前移到集合的第一个元素 IEnumerator.Current 。The MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the IEnumerator.Current property.
对返回的的最后一个调用 MoveNext
false
,它指示集合的末尾,枚举数置于集合的最后一个元素之后。The last call to MoveNext returnedfalse
, 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.
IEnumerator.Current 不移动枚举器的位置,并且连续调用将 IEnumerator.Current 返回相同的对象,直到 MoveNext IEnumerator.Reset 调用或。IEnumerator.Current does not move the position of the enumerator, and consecutive calls to IEnumerator.Current return the same object until either MoveNext or IEnumerator.Reset is called.