using C# VS 2010, windows forms. My goal is to open and close the file only once and \"overwrite\" it multiple times. I never want to append. The reason for opening and closing
You need to use
FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);