What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2021-11-07 05:58:10
create file if not exists c#
You can simply call using (StreamWriter w = File.AppendText("log.txt")) It will create the file if it doesn't exist and open the file for appending. Edit: This is sufficient: string path = txtFilePath.Text; using(StreamWriter ... Add solution -
C# 2021-09-21 21:22:04
c# create log file
From the performance point of view your solution is not optimal. Every time you add another log entry with +=, the whole string is copied to another place in memory. I would recommend using StringBuilder instead: StringBuilder sb = new StringBuilder(); .... Add solution -
C# 2021-08-28 01:21:01
List string to file C#
string[] lines = { "First line", "Second line", "Third line" }; System.IO.File.WriteAllLines(@"C:\Users\Public\TestFolder\WriteLines.txt", lines); lines = { "Fourth line", "Fith line" }; System.I... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5