Oakrey.Readers 5.0.0

dotnet add package Oakrey.Readers --version 5.0.0
                    
NuGet\Install-Package Oakrey.Readers -Version 5.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.Readers" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.Readers" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.Readers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.Readers --version 5.0.0
                    
#r "nuget: Oakrey.Readers, 5.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.Readers@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.Readers&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.Readers&version=5.0.0
                    
Install as a Cake Tool

Oakrey.Readers

Oakrey.Readers provides small, extensible helpers for reading text files line by line and representing each line as a strongly typed object.

Features

  • LineReader<TLine> reads text from a file, stream, or StreamReader and creates custom line objects.
  • Line exposes line number, original text, trimmed text, ordinal prefix checks, and simple empty/whitespace flags.
  • ComponentLine splits trimmed lines into components, caches parsed values internally, and returns defensive copies.
  • EscapeLine adds escape-character detection for component-based formats.
  • Helpers are designed for simple parser scenarios where line number diagnostics matter.

Installation

dotnet add package Oakrey.Readers

Package Manager Console:

Install-Package Oakrey.Readers

Basic Usage

using Oakrey.Readers;

using LineReader<Line> reader = new(new FileInfo("input.txt"));

while (reader.MoveNext())
{
    Line line = reader.Current;
    Console.WriteLine($"#{line.LineNumber}: {line.Text}");
}

Read a required non-empty line:

using LineReader<Line> reader = new(new FileInfo("input.txt"));
Line line = reader.NextLineNoneEmptyLine();

Skip blank lines until data is found:

using LineReader<Line> reader = new(new FileInfo("input.txt"));
Line line = reader.NextNonEmptyLine();

Custom Component Line

public sealed class CsvLikeLine(string text, int lineNumber) : ComponentLine(text, lineNumber)
{
    public override StringSplitOptions Options => StringSplitOptions.RemoveEmptyEntries;

    protected override char[] Separators => [',', ';'];
}

using LineReader<CsvLikeLine> reader = new(new FileInfo("input.txt"));
CsvLikeLine line = reader.NextLine();

Console.WriteLine(line.ComponentsCount);
Console.WriteLine(line[0]);

Notes

  • Custom line types used with LineReader<TLine> must expose a public constructor with (string text, int lineNumber) parameters.
  • Reset() requires a seekable underlying stream and resets line numbering back to the first line.
  • StartsWith(string) uses StringComparison.Ordinal by default for predictable parser behavior.

Requirements

  • .NET 10 or higher

Project Information

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net11.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Oakrey.Readers:

Package Downloads
Oakrey.DBC

Oakrey.DBC is a .NET 11 library for parsing, building, and exporting DBC (CAN database) files. Provides a full object model covering messages, signals (including multiplexing, big/little endian, scale/offset), nodes, attributes, value tables, and relationships. Supports async file parsing via DbcMatrix.CreateAsync and round-trip export via SaveDBC. Designed for automotive, industrial, and IoT applications.

Oakrey.LDF

Async parser, strongly-typed object model, and composer for LIN Description Files (LDF) per the LIN 2.x specification. Covers nodes, signals, frames, schedule tables, signal encoding types, and diagnostic elements. Supports round-trip export back to a spec-compliant LDF text file.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 74 11/13/2026
4.0.1 243 9/18/2026
4.0.0 432 7/13/2026
3.0.0 693 11/14/2025
2.0.0 352 11/13/2025
1.0.1 224 9/26/2025
1.0.0 427 4/16/2025