c# - Creating a new file each time program runs -


I am currently adding this to my file for each loop:

  By using (streamdriter sw = file .updated text (path)) {stringbuilder builder = new stringbillder (); . Builder.Append (LastName.Trim ()) attached ("\ t"); // more stuff  

But every time the user runs the program, I want to make the file from scratch. This file is currently being created if it does not exist - which is good - but it is also included at the end of the previously created file.

You can use

 using the  // file Once (TextWriter Writer = File. CreateText (Path)) {Add content to the file inside the (int i = 0; i & lt; iterations; i ++) {// loop author} Writite (LastName.Trim ()); // etc ...}}  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -