- 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

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -