StringReader.ReadBlock(Span<Char>) 方法

定義

從目前位置開始,讀取輸入字串中的所有字元,並將目前位置往前移至輸入字串的結尾。Reads all the characters from the input string starting at the current position and advances the current position to the end of the input string.

public:
 override int ReadBlock(Span<char> buffer);
public override int ReadBlock (Span<char> buffer);
override this.ReadBlock : Span<char> -> int
Public Overrides Function ReadBlock (buffer As Span(Of Char)) As Integer

參數

buffer
Span<Char>

當這個方法傳回時,會包含讀取自目前來源的字元。When this method returns, contains the characters read from the current source. 如果讀取的字元總數為零,則範圍會保持不變。If the total number of characters read is zero, the span remains unmodified.

傳回

讀入緩衝區的字元總數。The total number of characters read into the buffer.

例外狀況

目前的字串讀取器執行個體已關閉。The current string reader instance is closed.

備註

ReadBlock(Span<Char>) 會在內部直接呼叫 Read(Span<Char>)ReadBlock(Span<Char>) internally calls Read(Span<Char>) directly.

適用於