Bob.at.Indigo.Health
Bob.at.Indigo.Health

Reputation: 11895

CsvHelper custom delimiter

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)?

Upvotes: 12

Views: 8524

Answers (1)

Bob.at.Indigo.Health
Bob.at.Indigo.Health

Reputation: 11895

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);

Upvotes: 22

Related Questions