Sion.Useful.Files 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sion.Useful.Files --version 1.0.0                
NuGet\Install-Package Sion.Useful.Files -Version 1.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="Sion.Useful.Files" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sion.Useful.Files --version 1.0.0                
#r "nuget: Sion.Useful.Files, 1.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.
// Install Sion.Useful.Files as a Cake Addin
#addin nuget:?package=Sion.Useful.Files&version=1.0.0

// Install Sion.Useful.Files as a Cake Tool
#tool nuget:?package=Sion.Useful.Files&version=1.0.0                


NuGet package that provides useful file methods. Specifically, CSV file reading.


public static IEnumerable<string[]> Read(string path, string delimiter = ",", bool hasHeader = false)
public static IEnumerable<RowType> Read<RowType>(string path, string delimiter = ",", bool hasHeader = false) where RowType : class

How to use:

First, download the Sion.Useful.Files NuGet package, then include this using statement at the top of the file:

using Sion.Useful.Files;


Reading a CSV file and mapping it to a custom class

Things to note:

  • The delimiter defaults to a comma, but can be customized
  • The hasHeader defaults to false
  • The mapping currently only supports classes that use built-in property types
  • The mapping works best if there's a header row on the CSV file with column names that match the property names for the custom class (casing does matter)
  • Data needs to be properly formed if doing custom mapping, aka no empty column values
  • Empty column values are probably best as null values, please make this change before trying to read the CSV (I'll be making a method to automatically do this later)
  • If using null, please mark which properties are nullable in the class definition
// Every row in our CSV file is a Student object
public class Student {
	public long Id { get; set; }
	public string FirstName { get; set; } = "";
	public string? MiddleName { get; set; }
	public string LastName { get; set; } = "";
	public bool IsGraduateStudent { get; set; }
// Reading the CSV
IEnumerable<Student> students = Csv.Read<Student>("students.csv", hasHeader: true);
Reading a CSV file and receiving raw string data
IEnumerable<string[]> rows = Csv.Read("students.csv", hasHeader: true);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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
2.0.0 87 2/2/2024
1.3.2 143 9/5/2023
1.3.1 138 8/28/2023
1.3.0 136 8/21/2023
1.2.0 154 8/19/2023
1.1.0 153 8/14/2023
1.0.0 146 8/13/2023