DevToys.PocoCsv.Core
1.5.0
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 DevToys.PocoCsv.Core --version 1.5.0
NuGet\Install-Package DevToys.PocoCsv.Core -Version 1.5.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="DevToys.PocoCsv.Core" Version="1.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DevToys.PocoCsv.Core --version 1.5.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DevToys.PocoCsv.Core, 1.5.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 DevToys.PocoCsv.Core as a Cake Addin #addin nuget:?package=DevToys.PocoCsv.Core&version=1.5.0 // Install DevToys.PocoCsv.Core as a Cake Tool #tool nuget:?package=DevToys.PocoCsv.Core&version=1.5.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DevToys.PocoCsv.Core
The fastest Csv reader deserialzer available
DevToys.PocoCsv.Core is a class library to read and write to Csv. It contains CsvStreamReader, CsvStreamWriter and Serialization classes CsvReader<T> and CsvWriter<T>.
- Read/write serialize/deserialize data to and from Csv.
- Use Linq to query large CSV files with CsvReader<T>.ReadAsEnumerable().
- Use CsvWriter<T>.Write() to write large data tables to Csv.
- Retrieve schema for a csv file with CsvUtils.GetCsvSchema() which can be used to create a poco object.
Two flavors for reading and writing CSV files:
- Stream
- <T> Serialize / Deserialize to T
CsvStreamReader
string file = "C:\Temp\data.csv";
using (CsvStreamReader _reader = new CsvStreamReader(file))
{
_reader.Separator = ',';
while (!_reader.EndOfCsvStream)
{
List<string> _values = _reader.ReadCsvLine().ToList();
}
}
CsvStreamWriter
string file = @"D:\Temp\test.csv";
using (CsvStreamWriter _writer = new CsvStreamWriter(file))
{
var _line = new string[] { "Row 1", "Row A,A", "Row 3", "Row B" };
_writer.WriteCsvLine(_line);
}
CsvReader<T>
public class Data
{
[Column(Index = 0)]
public string Column1 { get; set; }
[Column(Index = 1)]
public string Column2 { get; set; }
[Column(Index = 2)]
public string Column3 { get; set; }
[Column(Index = 5)]
public string Column5 { get; set; }
}
string file = @"D:\Temp\data.csv");
using (CsvReader<Data> _reader = new(file))
{
_reader.Open();
_reader.Separator = ','; // or use _reader.DetectSeparator();
var _data = Reader.ReadAsEnumerable().Where(p => p.Column1.Contains("16"));
var _materialized = _data.ToList();
}
- Reader.ReadAsEnumerable() reads and deserializes each csv file line per iteration in the collection, this allows for querying mega sized files.
- CsvReader and CsvWriter can deserialize / serialize to simple types, this includes enum and byte[].
- use CsvReader.DetectSeparator() to auto set the separator (looks for commonly used separators in first 10 lines).
CsvWriter<T>
private IEnumerable<CsvSimple> LargeData()
{
for (int ii = 0; ii < 10000000; ii++)
{
CsvSimple _line = new()
{
AfBij = "bij",
Bedrag = "100",
Code = "test",
Datum = "20200203",
Mededelingen = $"test {ii}",
Rekening = "3434",
Tegenrekening = "3423424"
};
yield return _line;
}
}
string file = @"D:\largedata.csv";
using (CsvWriter<CsvSimple> _writer = new(file) { Separator = ',', Append = true })
{
_writer.Open();
_writer.Write(LargeData());
}
Product | Versions 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 |
---|---|---|
4.5.3 | 0 | 12/26/2024 |
4.5.2 | 70 | 12/18/2024 |
4.5.1 | 73 | 12/16/2024 |
4.5.0 | 72 | 12/16/2024 |
4.4.1 | 51 | 12/16/2024 |
4.4.0 | 91 | 12/14/2024 |
4.3.2 | 108 | 12/3/2024 |
4.3.1 | 88 | 11/22/2024 |
4.3.0 | 83 | 11/21/2024 |
4.2.5 | 84 | 11/20/2024 |
4.2.4 | 84 | 11/19/2024 |
4.2.3 | 99 | 11/13/2024 |
4.2.2 | 165 | 2/28/2024 |
4.2.1 | 121 | 2/24/2024 |
4.2.0 | 133 | 2/23/2024 |
4.1.2 | 108 | 2/22/2024 |
4.1.1 | 138 | 2/21/2024 |
4.1.0 | 131 | 2/21/2024 |
4.0.1 | 150 | 2/12/2024 |
4.0.0 | 136 | 2/12/2024 |
3.1.13 | 115 | 2/8/2024 |
3.1.12 | 155 | 2/7/2024 |
3.1.11 | 111 | 1/31/2024 |
3.1.10 | 122 | 1/19/2024 |
3.1.9 | 127 | 1/13/2024 |
3.1.8 | 127 | 1/12/2024 |
3.1.7 | 114 | 1/11/2024 |
3.1.5 | 138 | 1/8/2024 |
3.1.3 | 180 | 12/1/2023 |
3.1.2 | 140 | 12/1/2023 |
3.1.0 | 125 | 11/28/2023 |
3.0.7 | 213 | 8/27/2023 |
3.0.6 | 155 | 8/23/2023 |
3.0.5 | 165 | 8/23/2023 |
3.0.4 | 164 | 8/17/2023 |
3.0.3 | 180 | 8/15/2023 |
3.0.2 | 180 | 8/11/2023 |
3.0.1 | 199 | 8/11/2023 |
3.0.0 | 177 | 8/11/2023 |
2.0.7 | 224 | 8/9/2023 |
2.0.5 | 185 | 8/4/2023 |
2.0.4 | 184 | 8/3/2023 |
2.0.3 | 154 | 7/31/2023 |
2.0.2 | 181 | 7/28/2023 |
2.0.0 | 182 | 7/19/2023 |
1.7.53 | 221 | 4/14/2023 |
1.7.52 | 219 | 4/12/2023 |
1.7.51 | 206 | 4/7/2023 |
1.7.43 | 236 | 4/3/2023 |
1.7.42 | 218 | 4/3/2023 |
1.7.41 | 202 | 4/3/2023 |
1.7.5 | 207 | 4/7/2023 |
1.7.3 | 247 | 4/3/2023 |
1.7.2 | 235 | 4/3/2023 |
1.7.1 | 225 | 4/3/2023 |
1.7.0 | 233 | 4/1/2023 |
1.6.3 | 230 | 3/31/2023 |
1.6.2 | 232 | 3/29/2023 |
1.6.1 | 225 | 3/29/2023 |
1.6.0 | 221 | 3/27/2023 |
1.5.8 | 244 | 3/24/2023 |
1.5.7 | 216 | 3/22/2023 |
1.5.6 | 231 | 3/22/2023 |
1.5.5 | 240 | 3/21/2023 |
1.5.4 | 249 | 3/21/2023 |
1.5.1 | 238 | 3/20/2023 |
1.5.0 | 243 | 3/19/2023 |
1.4.5 | 239 | 3/18/2023 |
1.4.4 | 278 | 3/18/2023 |
1.4.3 | 234 | 3/18/2023 |
1.4.2 | 250 | 3/18/2023 |
1.4.1 | 216 | 3/18/2023 |
1.4.0 | 234 | 3/18/2023 |
1.3.92 | 245 | 3/18/2023 |
1.3.91 | 250 | 3/17/2023 |
1.3.9 | 237 | 3/17/2023 |
1.3.8 | 215 | 3/17/2023 |
1.3.7 | 244 | 3/17/2023 |
1.3.6 | 209 | 3/17/2023 |
1.3.5 | 226 | 3/17/2023 |
1.3.4 | 248 | 3/17/2023 |
1.3.3 | 237 | 3/16/2023 |
1.3.2 | 218 | 3/16/2023 |
1.3.1 | 245 | 3/16/2023 |
1.3.0 | 201 | 3/16/2023 |
1.2.0 | 239 | 3/14/2023 |
1.1.6 | 279 | 2/24/2023 |
1.1.5 | 324 | 2/16/2023 |
1.1.4 | 487 | 5/18/2022 |
1.1.3 | 723 | 1/27/2022 |
1.1.2 | 651 | 1/27/2022 |
1.1.1 | 704 | 1/14/2022 |
1.1.0 | 5,849 | 11/23/2021 |
1.0.5 | 400 | 5/11/2021 |
1.0.4 | 345 | 4/14/2021 |
1.0.3 | 386 | 4/12/2021 |
1.0.2 | 342 | 4/12/2021 |
1.0.1 | 323 | 4/7/2021 |
1.0.0 | 395 | 4/7/2021 |