I am trying to add a specific line of text in a file. Specifically between two boundaries.
An example of what it would look like if I wanted to add a line in between
You should not open your file twice, try this:
FileStream fileStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
StreamWriter streamWriter = new StreamWriter(fileStream);
StreamReader streamReader = new StreamReader(fileStream);
another think is logic for inserting line, maybe easier way is to copy data line by line into new file, insert new part when needed and continue. Or do it in memory.
To add line to the end you can use FileMode.Append or do your own seek