I am working on a utility.
I want to append data at the top of the file, but it is overwritting not appending.
For eg : Consider the file.txt :
Yes
FileStream fs = new FileStream( path2, FileMode.OpenOrCreate, FileAccess.ReadWrite );
sw = new StreamWriter( fs );
sw.BaseStream.Seek( 0, 0 );
sw.WriteLine( "write new text" );
sw.close()
This method will overwrite any existing data, akin insert and replace.