FileMode.Open and FileMode.OpenOrCreate difference when file exists? c# bug?

I have just reproduced that issue.
As I wrote in comment.

FileMode.Open erases contents of the file while FileMode.OpenOrCreate does not.

It seems that new content of the file is one char shorter than previous that’s why you see “>” at the end.

If you are writing the file use FileMode.Create that should do for you.

Leave a Comment