0

Another Problem in C#!

I want to move lines in a text file! Is there a method that I can use! I used replace to replace strings in file, but I want to move the whole line o text to another position in the file!

8th Dec 2016, 11:48 AM
Mitran Constantin Bogdan
Mitran Constantin Bogdan - avatar
1 Answer
+ 2
Try this (swap lines 4 - 5): string[] lines = File.ReadAllLines("file.txt"); string tmp = lines[4]; lines[4] = lines[5]; lines[5] = tmp; File.WriteAllLines("file.txt", lines);
9th Dec 2016, 2:43 PM
AtoMX
AtoMX - avatar