Adrichem.Serialization.CsvSerializer 2.0.0

Serialize and deserialize .csv files.

There is a newer version of this package available.
See the version list below for details.
Install-Package Adrichem.Serialization.CsvSerializer -Version 2.0.0
dotnet add package Adrichem.Serialization.CsvSerializer --version 2.0.0
<PackageReference Include="Adrichem.Serialization.CsvSerializer" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Adrichem.Serialization.CsvSerializer --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Serialize and deserialize .csv files

Inspired by https://gist.github.com/caschw/ddac05f58f1f081bd9da

  1. Can serialize anonymous classes in addition to regular classes.
  2. Supports fields and properties.
  3. Supports culture specific formatting of values.
  4. Configurable separator, rownumbers

Serialization example

var Data = ...Some IEnumerable...
var SerializationOptions = new CsvSerializationOptions
{
    Separator = ';',
    Culture = CultureInfo.GetCultureInfo("nl-nl")
};

var Output = new MemoryStream();
CsvSerializer.Serialize(Output, Data, SerializationOptions);

Deserialization example

string ENUSTest = "Double;Float;Date\n1.1;2.2;12/23/2018 12:00:00 AM";

var DeserializationOptions = new CsvDeserializationOptions
{
    Culture = CultureInfo.GetCultureInfo("en-us"),
    Separator = ';'
};

var Data = CsvSerializer.Deserialize<HasLocalizable>(StringToStream(ENUSTest), DeserializationOptions);

Serialize and deserialize .csv files

Inspired by https://gist.github.com/caschw/ddac05f58f1f081bd9da

  1. Can serialize anonymous classes in addition to regular classes.
  2. Supports fields and properties.
  3. Supports culture specific formatting of values.
  4. Configurable separator, rownumbers

Serialization example

var Data = ...Some IEnumerable...
var SerializationOptions = new CsvSerializationOptions
{
    Separator = ';',
    Culture = CultureInfo.GetCultureInfo("nl-nl")
};

var Output = new MemoryStream();
CsvSerializer.Serialize(Output, Data, SerializationOptions);

Deserialization example

string ENUSTest = "Double;Float;Date\n1.1;2.2;12/23/2018 12:00:00 AM";

var DeserializationOptions = new CsvDeserializationOptions
{
    Culture = CultureInfo.GetCultureInfo("en-us"),
    Separator = ';'
};

var Data = CsvSerializer.Deserialize<HasLocalizable>(StringToStream(ENUSTest), DeserializationOptions);

  • .NETStandard 2.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.1.0 97 2/2/2020
3.0.0 303 3/12/2019
2.0.0 372 7/28/2018