What is the efficient way of replacing last line in file?
I am expecting my file to be ending with "]" and I would like to replace "]" with new data that will end again with "]".
This is only example a file will be really large ...
Old:
[
a
b
c
]
new:
[
a
b
c
d
e
]
I have full control of how files are written, created.
EDIT:
    // mockData.json
    //[
    //    a
    //    b
    //    c
    //]
    var fileName = "mockData.json";
    var origData = File.ReadAllLines(fileName);
    origData[origData.Length - 1] = " d\n e\n]";
    File.WriteAllLines(fileName, origData);