FileHelpers.Core 9.0.5

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

FileHelpers.Core

A powerful and easy-to-use .NET library for importing and exporting data from fixed-length or delimited files, strings, or streams.

Features

  • Declarative Mapping: Use attributes to define file structure
  • Multiple Formats: Support for CSV, fixed-length, and custom delimited formats
  • Type Conversion: Automatic conversion between file data and .NET types
  • Error Handling: Robust error management and validation
  • Async Support: Asynchronous reading and writing for large files
  • Performance: Optimized for speed and memory efficiency

Installation

dotnet add package FileHelpers.Core

Quick Start

Reading a CSV File

using FileHelpers.Core;

// Define your record class
[DelimitedRecord(",")]
public class Customer
{
    public string Name { get; set; }
    public string Email { get; set; }
    public DateTime RegisterDate { get; set; }
}

// Read the file
var engine = new FileHelperEngine<Customer>();
var records = engine.ReadFile("customers.csv");

foreach (var customer in records)
{
    Console.WriteLine($"{customer.Name} - {customer.Email}");
}

Writing to a File

var customers = new List<Customer>
{
    new Customer { Name = "John Doe", Email = "john@example.com", RegisterDate = DateTime.Now },
    new Customer { Name = "Jane Smith", Email = "jane@example.com", RegisterDate = DateTime.Now }
};

var engine = new FileHelperEngine<Customer>();
engine.WriteFile("output.csv", customers);

Fixed-Length Records

[FixedLengthRecord]
public class Product
{
    [FieldFixedLength(10)]
    public string SKU { get; set; }
    
    [FieldFixedLength(30)]
    public string Description { get; set; }
    
    [FieldFixedLength(8)]
    [FieldConverter(ConverterKind.Decimal)]
    public decimal Price { get; set; }
}

Advanced Features

Custom Converters

[DelimitedRecord(",")]
public class Order
{
    public int OrderId { get; set; }
    
    [FieldConverter(typeof(MyCustomDateConverter))]
    public DateTime OrderDate { get; set; }
}

Error Handling

var engine = new FileHelperEngine<Customer>();
engine.ErrorMode = ErrorMode.SaveAndContinue;

var records = engine.ReadFile("data.csv");

if (engine.ErrorManager.HasErrors)
{
    foreach (var error in engine.ErrorManager.Errors)
    {
        Console.WriteLine($"Line {error.LineNumber}: {error.ExceptionInfo.Message}");
    }
}

Async Reading

var engine = new FileHelperAsyncEngine<Customer>();

using (engine.BeginReadFile("large-file.csv"))
{
    await foreach (var customer in engine.ReadNextAsync())
    {
        // Process each record
    }
}

Supported Formats

  • CSV - Comma-separated values
  • TSV - Tab-separated values
  • Fixed-Length - Fixed-width column files
  • Custom Delimited - Any custom delimiter
  • Multi-Record - Files with multiple record types

.NET Version Support

  • .NET 9.0
  • Built with modern C# features and performance optimizations

About This Fork

This is a maintained fork of the FileHelpers library, targeting .NET 9. The original FileHelpers library was created by Marcos Meli.

Why This Fork?

  • Updated for .NET 9
  • Maintained for modern .NET applications
  • Compatible with latest C# features
  • Active development and bug fixes

Documentation

For more examples and detailed documentation, visit:

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License - See LICENSE file for details

Original FileHelpers library: Copyright (c) Marcos Meli - Devoo
This fork: Maintained by RetailerSoft

Support

Examples

Skip Header Rows

[DelimitedRecord(",")]
[IgnoreFirst(1)]  // Skip header row
public class DataRecord
{
    public string Column1 { get; set; }
    public string Column2 { get; set; }
}

Conditional Record Reading

var engine = new FileHelperEngine<Customer>();
var records = engine.ReadFile("data.csv")
    .Where(c => c.RegisterDate > DateTime.Now.AddYears(-1));

Writing with Custom Header

var engine = new FileHelperEngine<Customer>();
engine.HeaderText = "Name,Email,Registration Date";
engine.WriteFile("output.csv", customers);

Performance Tips

  • Use FileHelperAsyncEngine for large files
  • Set ErrorMode.IgnoreAndContinue if you don't need error details
  • Consider using streaming for memory-intensive operations
  • Cache engine instances when processing multiple files

Common Scenarios

Import Excel/CSV Data

Perfect for importing data from spreadsheets into your application.

Export Reports

Generate CSV files for reporting and data exchange.

Data Migration

Move data between systems using flat files.

ETL Operations

Extract, transform, and load data pipelines.

Log File Parsing

Parse structured log files into .NET objects.


FileHelpers.Core - Making file I/O simple and elegant for .NET developers! ??

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.

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
9.0.5 4,202 12/6/2025
9.0.4 4,198 12/6/2025

.NET 9 fork with README. Original: www.filehelpers.net/changelog