Advertisement
elena1234

Merge Files- with class File

Jan 15th, 2021
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4.  
  5. namespace MergeFiles
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var list = File.ReadAllLines(@"..\..\..\input1.txt").ToList();
  12.             list.AddRange(File.ReadAllLines(@"..\..\..\input2.txt"));
  13.             list.OrderBy(x=>x);
  14.             File.WriteAllLines(@"..\..\..\output.txt", list);
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement