Anixe.Ion 3.0.3

dotnet add package Anixe.Ion --version 3.0.3
                    
NuGet\Install-Package Anixe.Ion -Version 3.0.3
                    
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="Anixe.Ion" Version="3.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Anixe.Ion" Version="3.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Anixe.Ion" />
                    
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 Anixe.Ion --version 3.0.3
                    
#r "nuget: Anixe.Ion, 3.0.3"
                    
#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 Anixe.Ion@3.0.3
                    
#: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=Anixe.Ion&version=3.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Anixe.Ion&version=3.0.3
                    
Install as a Cake Tool

IonReader

Introduction

Anixe.Ion library is a .NET library that provides reader with fast, non-cached, forward only access to *.ion files and writer to build ion file content.

Features

IonReaderFactory

Anixe.Ion library provides static factory which can create an instance for IonReader interface. Factory enables two ways of creation the IonReader instance:

  1. With path to the file. File is opened with: FileMode.Open, FileAccess.Read, FileShare.ReadWrite. Possible argument exceptions:
    • ArgumentException with message "File path must be defined!" when given file path is null, empty or contains only white spaces.
    • ArgumentException with message "File 'XXX' does not exist!" when given XXX path does not exist on disk.
  2. With Stream.
IonReader interface
Properties
  • CurrentLine gets current line value. It causes new string allocation from CurrentRawLine
  • CurrentRawLine gets current line value as ArraySegment<char>. It is allocation free. Data is from rented buffer.
  • CurrentLineNumber gets current line number
  • CurrentSection gets information about current section name. Its value will change only when CurrentLine is on line which begins with '['
  • IsSectionHeader gets boolean value indicating whether first character of CurrentLine is '['
  • IsComment gets boolean value indicating whether first character of CurrentLine is '#'
  • IsTableRow gets boolean value indicating whether first character of CurrentLine is '|'
  • IsTableHeaderRow gets boolean value indicating whether first character of CurrentLine is '|' and current table header was not already passed
  • IsTableHeaderSeparatorRow gets boolean value indicating whether first character of CurrentLine is '|' and second character is '-'
  • IsTableDataRow gets boolean value indicating whether first character of CurrentLine is '|' and current table header was already passed
  • IsEmptyLine returns boolean value indicating whether first character of CurrentLine is empty string or line is filled with empty spaces
  • IsProperty returns boolean value indicating whether other properties are false
Methods
  • Read reads each *.ion file line and returns boolean value indicating whether reading was successful or not
  • Dispose calls Dispose method of the underlying stream
GenericSectionReader class
Events
  • OnReadSection the event handler fired for each section with section name in args
Methods
  • Read the main method of the class, it reads the stream provided by IonReader and fires an event for each section

Example use

With file path

class MainClass
{
    public static void Main(string[] args)
    {
        using(IIonReader reader = IonReaderFactory.Create("/path/to/example.ion"))
        {
            ReadIon(reader);
        }
    }

    private static void ReadIon(IIonReader reader)
    {
        while(reader.Read())
        {
            Console.WriteLine(reader.CurrentLine);
        }
    }
}

With stream

class MainClass
{
    public static void Main(string[] args)
    {
        using(FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            using(IIonReader reader = IonReaderFactory.Create(fileStream))
            {
                ReadIon(reader);
            }
        }
    }

    private static void ReadIon(IIonReader reader)
    {
        while(reader.Read())
        {
            Console.WriteLine(reader.CurrentLine);
        }
    }
}

With SectionReader

class MainClass
{
    public static void Main(string[] args)
    {
        using(FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            using(IIonReader reader = IonReaderFactory.Create(fileStream))
            {
                ReadIon(reader);
            }
        }
    }

    private static void ReadIon(IIonReader reader)
    {
        var sectionReader = new GenericSectionReader(reader);
        sectionReader.OnReadSection += (sender, args) =>
        {
          //TODO: check args.SectionName to determine current section
        };
        sectionReader.Read();
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.3 771 7/3/2025
3.0.2 143 7/2/2025
3.0.1 299 6/26/2025
3.0.0 151 6/24/2025
2.1.1 31,205 5/25/2021
2.1.0 1,046 4/12/2021
2.0.18 2,528 2/3/2021
2.0.17 1,684 9/3/2020
2.0.16 1,349 8/27/2020
2.0.15 575 8/18/2020
2.0.14 602 8/18/2020
2.0.13 1,631 6/22/2020
2.0.12 892 5/28/2020
2.0.11 2,540 11/7/2019
2.0.10 2,614 6/25/2019
2.0.9 684 6/25/2019
2.0.8 701 6/24/2019
2.0.7 696 6/24/2019
2.0.6 2,195 10/15/2018
2.0.5 913 10/8/2018
2.0.4 918 10/3/2018
2.0.3 987 10/2/2018
2.0.2 945 10/2/2018
2.0.1 958 10/2/2018
2.0.0 956 10/2/2018
1.0.6 1,406 1/22/2018
1.0.5 1,328 8/21/2017
1.0.4 1,159 8/19/2017
1.0.3 1,163 8/18/2017
1.0.2 1,171 8/18/2017
1.0.1 1,368 9/8/2016