I keep getting the following exception:
System.IO.IOException HResult=0x80070020 Message=The process cannot access the file 'C:\DIPV3\result.csv' because it is being used by another process.
Is there a better way to attempt this solution using a combination of Streams or Linq? The code below writes the file partially but then throws an the exception stated above.
string sourceDir = @"C:\DIPV3";
string output = @"C:\DIPV3\result.csv";
//Thread.Sleep(5000);
File.WriteAllLines(output,
Directory.EnumerateFiles(sourceDir, @"*.csv").SelectMany(file => File.ReadLines(file)));