The Fastest Way to Write Text Files to Disk in C#

A few weeks ago I was tasked with creating a very large CSV file with some dynamic content. I decided that this would be an excellent opportunity to try out some of my C# skills and write the content of the file using a loop. I quickly realized that not all methods of writing files to the hard drive perform the same. In fact, some methods are just plain terrible. I decided to write this article to compare different ways to write text files and evaluate their performance.

Read more