- Where Developers Learn, Share, & Build Careers
I have a bunch of txt files in a directory, which I want to merge into a file. At the end of each file I want to add a cart / return line.
What is the best way to do this in C #?
One-liner that is significantly worse on memory consumption:
File. Merge all lines (targetFileName, Directory.GetFiles (srcFolder, "* .txt") .SelectMany (f => File.ReadLines (f) .Concat (new [] {Environment.NewLine}))); Hope you can stay in the end with additional Newline.
Comments
Post a Comment