StringBuilder.ChunkEnumerator StringBuilder.ChunkEnumerator StringBuilder.ChunkEnumerator StringBuilder.ChunkEnumerator Struct


支持对 StringBuilder 实例的区块进行简单迭代。Supports simple iteration over the chunks of a StringBuilder instance.

public: value class StringBuilder::ChunkEnumerator
public struct StringBuilder.ChunkEnumerator
type StringBuilder.ChunkEnumerator = struct
Public Structure StringBuilder.ChunkEnumerator


方法返回StringBuilder.GetChunksChunkEnumeratorA ChunkEnumerator is returned by the StringBuilder.GetChunks method. IEnumerable同时支持和C# For Each foreach IEnumerator模式, 以便可以在中或在 Visual Basic 中枚举区块。It supports both the IEnumerable and IEnumerator patterns so that the chunks can be enumerated with foreach in C# or For Each in Visual Basic.

ChunkEnumerator是公共结构, 因此语言编译器可以使用它来生成foreach语句。ChunkEnumerator is a public structure so that language compilers can use it to build a foreach statement. 但是, 开发人员通常不会显式使用它 (这就是嵌套类型的原因)。However, developers typically don't use it explicitly (which is why it is a nested type).


Current Current Current Current

获取集合的区块和当前位置。Gets the chunk and the current position of the collection.


GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

提供以 IEnumerator 形式返回 thisGetEnumerator() 实现。Provides an GetEnumerator() implementation that returns this as the IEnumerator.

MoveNext() MoveNext() MoveNext() MoveNext()

使枚举数前进到集合中的下一区块。Advances the enumerator to the next chunk in the collection.