Reputation: 95
How to remove everything from text file before writing?
System.IO.File.AppendAllText(@"D:\text.txt", Environment.NewLine + item);
This is how I am writing to it.
Upvotes: 0
Views: 558
Reputation: 33381
Use WriteAllText instead of AppendAllText
System.IO.File.WriteAllText(@"D:\text.txt", item);
Upvotes: 5