ImmutableSortedDictionary<TKey,TValue>.Enumerator 结构

定义

枚举二进制树的内容。Enumerates the contents of a binary tree.

NuGet package: System.Collections.Immutable关于不可变集合和安装方法NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public: value class ImmutableSortedDictionary<TKey, TValue>::Enumerator : System::Collections::Generic::IEnumerator<System::Collections::Generic::KeyValuePair<TKey, TValue>>
public struct ImmutableSortedDictionary<TKey,TValue>.Enumerator : System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey,TValue>>
type ImmutableSortedDictionary<'Key, 'Value>.Enumerator = struct
    interface IEnumerator<KeyValuePair<'Key, 'Value>>
    interface IEnumerator
    interface IDisposable
Public Structure ImmutableSortedDictionary(Of TKey, TValue).Enumerator
Implements IEnumerator(Of KeyValuePair(Of TKey, TValue))

类型参数

TKey
TValue
继承
ImmutableSortedDictionary<TKey,TValue>.Enumerator
实现

注解

此结构应与其他两个二进制树枚举器保持同步: System.Collections.Immutable.ImmutableList<T>.EnumeratorSystem.Collections.Immutable.ImmutableSortedSet<T>.EnumeratorThis structure should be kept synchronized with the other two binary tree enumerators: System.Collections.Immutable.ImmutableList<T>.Enumerator and System.Collections.Immutable.ImmutableSortedSet<T>.Enumerator.

注意

如果此枚举器用作值类型 (即,当它不是装箱) 时,不要通过将其分配给第二个变量或将其传递给其他方法来复制它。When this enumerator is used as a value type (that is, when it isn't boxed), do not copy it by assigning it to a second variable or by passing it to another method. 当处理此枚举器时,它会将可变引用类型堆栈返回到资源池,并且如果将值类型枚举器复制 (如果你在) 上传递值,这可能很容易出现,则存在已返回到资源池的堆栈可能仍被某个枚举器副本使用,导致数据损坏或异常。When this enumerator is disposed of, it returns a mutable reference type stack to a resource pool, and if the value type enumerator is copied (which can easily happen unintentionally if you pass the value around), there is a risk that a stack that has already been returned to the resource pool may still be in use by one of the enumerator copies, leading to data corruption or exceptions.

属性

Current

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

方法

Dispose()

释放 ImmutableSortedDictionary<TKey,TValue>.Enumerator 类的当前实例使用的资源。Releases the resources used by the current instance of the ImmutableSortedDictionary<TKey,TValue>.Enumerator class.

MoveNext()

将枚举器推进到不可变排序字典的下一个元素。Advances the enumerator to the next element of the immutable sorted dictionary.

Reset()

将枚举器设置到其初始位置,该位置位于不可变排序字典中的第一个元素之前。Sets the enumerator to its initial position, which is before the first element in the immutable sorted dictionary.

显式接口实现

IEnumerator.Current

当前元素。The current element.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.