You basically need to read the data in and then write it back out again. Open a StreamReader, read the first two lines, close the StreamReader, open a StreamWriter, write out the first two lines and then write out the rest of the new content.
There are lots of examples of using StreamReaders and StreamWriters already out there. How about you have a go at doing it for yourself and then post back here with what you tried if it doesn't work?
If you want the entire contents of a file then you can call File.ReadAllText. If you want just a single line you can create a StreamReader and call ReadLine. In both cases, a String is returned, so you can assign it to a String variable.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.