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!
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);