How can I clear the content of a file?

后端 未结 6 1755
慢半拍i
慢半拍i 2020-12-02 21:48

I need to clear the contents of a particular file every time the applications starts. How do I do it?

6条回答
  •  萌比男神i
    2020-12-02 22:36

    Use FileMode.Truncate everytime you create the file. Also place the File.Create inside a try catch.

提交回复
热议问题