In the past, for c# .net MVC projects, I used TextFieldParser from the Visual Basic Reference. Now with .Net Core 1 that no longer seems to be an option. At least I can't figure out how to add the visual basic reference and I imagine if you did wouldn't it make it so it wasn't cross-platform?
The TextFieldParser was great because it covered all of my CSV import needs with great flexibility.
Is there a replacement for the TextFieldParser in .netCore that I am missing? Or is there a way to use the current textfieldparser without breaking cross-platform compatibility?
I have just tried CsvHelper - a .NET library for reading and writing CSV files. It covers all needs. Looks fast, flexible and easy to use. Supports reading and writing of custom class objects. It works fine with .NET Core
(as it supports .NET Standard 2.0
) as well as with .NET Framework 4.5
see dependencies on NuGet page.
For those that need it, TextFieldParser
can handle more than just CSV. It supports tab delimited, fixed width fields, etc.
I created a 1 to 1 port of TextFieldParser
for .NET Core.
You can get it via nuget by searching for TextFieldParserCore
.
https://www.nuget.org/packages/TextFieldParserCore/1.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With