RG.CsvSerializer
2.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package RG.CsvSerializer --version 2.0.6
NuGet\Install-Package RG.CsvSerializer -Version 2.0.6
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.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RG.CsvSerializer --version 2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RG.CsvSerializer, 2.0.6"
#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.6 // Install RG.CsvSerializer as a Cake Tool #tool nuget:?package=RG.CsvSerializer&version=2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CsvSerializer: The Fastest CSV Serializer for .NET
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; }
}
Serializing to stream:
CsvSerializer.Serialize(streamWriter, items, withHeaders: true);
Deserializing from stream:
IEnumerable<Item> items = CsvSerializer.Deserialize<Item>(streamReader, hasHeaders: true);
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.7 | 77 | 12/10/2024 |
2.0.6 | 108 | 11/13/2024 |
2.0.6-preview1 | 221 | 8/8/2024 |
2.0.5 | 419 | 11/19/2023 |
2.0.4 | 153 | 11/18/2023 |
2.0.2 | 173 | 11/14/2023 |
2.0.1 | 154 | 11/13/2023 |
2.0.0 | 167 | 11/12/2023 |
1.0.10 | 1,031 | 10/10/2019 |
1.0.9 | 501 | 10/10/2019 |
1.0.8 | 529 | 10/10/2019 |
1.0.7 | 523 | 10/9/2019 |
1.0.6 | 524 | 10/9/2019 |
1.0.5 | 558 | 9/10/2019 |
1.0.4 | 543 | 9/9/2019 |
1.0.3 | 546 | 9/5/2019 |
1.0.2 | 550 | 8/24/2019 |
1.0.1 | 528 | 8/23/2019 |
1.0.0 | 551 | 8/23/2019 |