ImmutableSortedSet<T>.GetEnumerator 方法

定义

返回一个循环访问不可变排序集的枚举器。Returns an enumerator that iterates through the immutable sorted set.

public:
 System::Collections::Immutable::ImmutableSortedSet<T>::Enumerator GetEnumerator();
public System.Collections.Immutable.ImmutableSortedSet<T>.Enumerator GetEnumerator ();
member this.GetEnumerator : unit -> System.Collections.Immutable.ImmutableSortedSet<'T>.Enumerator
Public Function GetEnumerator () As ImmutableSortedSet(Of T).Enumerator

返回

一个可用于循环访问集的枚举器。An enumerator that can be used to iterate through the set.

注解

注意

将此枚举器用作值类型(即,如果它未装箱),请不要通过将其分配给第二个变量或将其传递给其他方法来复制它。When you use this enumerator 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 and exceptions.

System.object NuGet 包System.Collections.Immutable NuGet package

关于不可变集合以及如何安装About immutable collections and how to install

适用于