Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CsvHelper custom delimiter

Tags:

csvhelper

In earlier versions of CsvHelper, I could set the default delimiter like this:

using var csv = new CsvReader(reader, CultureInfo.CurrentCulture);
csv.Configuration.Delimiter = "~";

How do I do this same thing in the current version (version 22)?

like image 411
Bob.at.Indigo.Health Avatar asked Mar 07 '26 20:03

Bob.at.Indigo.Health


1 Answers

After a bit of Googling, I found this post in the CsvHelper issues. So, in the context of my original question, the correct code is now:

var config = new CsvConfiguration(CultureInfo.CurrentCulture) { Delimiter = "~" };
using var csv = new CsvReader(reader, config);
like image 86
Bob.at.Indigo.Health Avatar answered Mar 10 '26 07:03

Bob.at.Indigo.Health



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!