What is the most efficient way of writing several lines of data to a *.txt file? Currently, I store the required text in memory then write it all to a user-specified text file at the end, similar to the following;
Dim text As String = "" text = text + "1st line of text" & vbNewLine text = text + "2nd line of text" & vbNewLine text = text + "3rd line of text" & vbNewLine Dim path As String = "C:\Temp\fileName.txt" My.Computer.FileSystem.WriteAllText(path, text, True, System.Text.Encoding.Default)
This works well enough for up to about 1000 lines of text. However, I often need to write 3000+ lines to a single file and it is noticeably slow using the above method. Is there a more efficient way?
Thanks in advance!