Closed arialdomartini closed 1 year ago
Save ()
and SaveToString ()
depends on TextWriter
's WriteLine ()
method to write line terminate at the end of each line.
TextWriter
outputs the line terminator which defaults to the system's default.
But it can be changed via setting NewLine
property of TextWriter
.
Loot at: https://learn.microsoft.com/en-us/dotnet/api/system.io.textwriter.newline?view=net-7.0
I think we can add a optional parameter to the Save ()
and SaveToString ()
methods.
cc @cartermp
Yes, that would be useful. Please, consider that as per the RFC 4180 rule 2.1
| 1. Each record is located on a separate line, delimited by a line break (CRLF)
regardless the hosting OS.
So I guess this was technically a breaking change, but I think "correctly adhering to the standard" is fine, so this is in, and it'll be a minor version bump because versioning is whatever we want it to be.
I'm using the CVS Type Provider to parse a CSV file, make some modifications, and writing it back.
In Windows,
Save()
andSaveToString()
always output a file withCRLF
style, even when the original file was using the Unix linefeed style.It would be nice if there was a way to preserve the line feed style. Is there any way to do so?