LineReader Struct

A line reader from a TextReader that can provide precise source position

public struct LineReader

Constructors

NameDescription
LineReader(string)Initializes a new instance of the LineReader class.

LineReader(string)

LineReader.cs

Initializes a new instance of the LineReader class.

public LineReader(string text)

Parameters

text string

Exceptions

ArgumentNullException
ArgumentOutOfRangeException
bufferSize cannot be <= 0

Properties

NameDescription
SourcePositionGets the char position of the line. Valid for the next line before calling LineReader.ReadLine.

SourcePosition

LineReader.cs

Gets the char position of the line. Valid for the next line before calling LineReader.ReadLine.

public readonly int SourcePosition { get; }

Property value

int

Methods

NameDescription
ReadLine()Reads a new line from the underlying TextReader and update the LineReader.SourcePosition for the next line.

ReadLine()

LineReader.cs

Reads a new line from the underlying TextReader and update the LineReader.SourcePosition for the next line.

public StringSlice ReadLine()

Returns

StringSlice A new line or null if the end of TextReader has been reached