Clearing content of text file using C#

前端 未结 5 1653
别那么骄傲
别那么骄傲 2020-12-05 01:15

How can I clear the content of a text file using C# ?

5条回答
  •  孤城傲影
    2020-12-05 02:02

    You can use always stream writer.It will erase old data and append new one each time.

    using (StreamWriter sw = new StreamWriter(filePath))
    {                            
        getNumberOfControls(frm1,sw);
    }
    

提交回复
热议问题