AngleSharp by Florian Rappl

<PackageReference Include="AngleSharp" Version="0.8.3" />

 TextSource

sealed class TextSource : IDisposable
A stream abstraction to handle encoding and more.
public Encoding CurrentEncoding { get; set; }

Gets or sets the encoding to use.

public int Index { get; set; }

Gets or sets the current index of the insertation and read point.

public char this[int index] { get; }

Gets the character at the given position in the text buffer.

public int Length { get; }

Gets the length of the text buffer.

public string Text { get; }

Gets the full text buffer.

public TextSource(string source)

Creates a new text source from a string. No underlying stream will be used.

public TextSource(Stream baseStream, Encoding encoding = null)

Creates a new text source from a string. The underlying stream is used as an unknown data source.

public void Dispose()

public void InsertText(string content)

Inserts the given content at the current insertation mark. The insertation mark won't be changed.

public Task Prefetch(int length, CancellationToken cancellationToken)

public char ReadCharacter()

Reads the next character from the buffer or underlying stream, if any.

public Task<char> ReadCharacterAsync(CancellationToken cancellationToken)

Reads the next character from the buffer or underlying stream asynchronously, if any.

public string ReadCharacters(int characters)

Reads the upcoming numbers of characters from the buffer or underlying stream, if any.

public Task<string> ReadCharactersAsync(int characters, CancellationToken cancellationToken)

Reads the upcoming numbers of characters from the buffer or underlying stream asynchronously.