RG.CsvSerializer 2.0.5

dotnet add package RG.CsvSerializer --version 2.0.5
NuGet\Install-Package RG.CsvSerializer -Version 2.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="RG.CsvSerializer" Version="2.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RG.CsvSerializer --version 2.0.5
#r "nuget: RG.CsvSerializer, 2.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.
// Install RG.CsvSerializer as a Cake Addin
#addin nuget:?package=RG.CsvSerializer&version=2.0.5

// Install RG.CsvSerializer as a Cake Tool
#tool nuget:?package=RG.CsvSerializer&version=2.0.5

NuGet

Installation

Package Manager Console:

Install-Package RG.CsvSerializer

Usage

using Csv;

// Serialize collection to CSV string
string csv = CsvSerializer.Serialize(items, withHeaders: true);

// Deserialize CSV string to array
Item[] items = CsvSerializer.Deserialize<Item>(csv, hasHeaders: true);

With custom delimiter:

Item[] items = CsvSerializer.Deserialize<Item>(csv, hasHeaders: true, separator: ';');

With custom header name and date format:

class Product {
    public string Name { get; set; }
    
    [CsvColumn("Price")]
    public decimal PriceBeforeTaxes { get; set; }
    
    [CsvColumn("Added", DateFormat = "dd/MM/yyyy")]
    public DateTime Added { get; set; }
}

Supported Property Types

bool
bool?
byte
byte?
sbyte
sbyte?
short
short?
ushort
ushort?
int
int?
uint
uint?
long
long?
ulong
ulong?
float
float?
double
double?
decimal
decimal?
string
DateTime
DateTime?
Uri // serialized as quoted string
Enum // serialized as unquoted string
Enum? // serialized as unquoted string

Not yet supported:

char
char?
DateTimeOffset
DateTimeOffset?
TimeSpan
TimeSpan?
Guid
Guid?
any Object to string (serialize only)
any Object to JSON
any Object to MessagePack Base64
any Object to MessagePack Hex string
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.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.5 277 11/19/2023
2.0.4 108 11/18/2023
2.0.2 118 11/14/2023
2.0.1 112 11/13/2023
2.0.0 116 11/12/2023
1.0.10 982 10/10/2019
1.0.9 464 10/10/2019
1.0.8 501 10/10/2019
1.0.7 489 10/9/2019
1.0.6 489 10/9/2019
1.0.5 521 9/10/2019
1.0.4 514 9/9/2019
1.0.3 511 9/5/2019
1.0.2 515 8/24/2019
1.0.1 493 8/23/2019
1.0.0 513 8/23/2019