I need to clear the contents of a particular file every time the applications starts. How do I do it?
Use FileMode.Truncate everytime you create the file. Also place the File.Create inside a try catch.
FileMode.Truncate
File.Create
try
catch