Enforce LF line endings with CsvHelper

If I have some LFconverted (using N ++) CSV files, every time I write data to them using JoshClose CsvHelper, the line ending returns to CRLF.

Since I am having problems with CLRF ROWTERMINATORSin SQL Server, I want to keep the line ending as well as the initial status of the file.

Could not find it in the culture settings, I am compiling my version of the library.

How to act?

+4
source share
1 answer

, , CvsHelper. , , CsvWriter.

TextWriter tw = File.CreateText(filepathname);
tw.NewLine = "\n";
CsvWriter csvw = new CsvWriter(tw);
csvw.WriteRecords(records);
csvw.Dispose();
+3

All Articles