I have file with following content:
This line number 1
I like playing football
This is the end
I want to add the line with text just after the second line:
This line number 1
I like playing football
I like eating pasta <------ this line shall be added
This is the end
Is there any other simpler way to do so, than saving all lines (let me tell, there are n lines) to the array with n+1 elements and move them down, etc. , etc.
As a technical detail I can tell I use System.IO.StreamWriter
and System.IO.File
.
Search-engine on SO doesn't give results I wanted to see... C# Reference also didn't give expected result.