I have to write 300+ files to a server share on a hourly basis. A quick implementation using CreateText takes approximately 1.4 seconds per file. I know there is a better way to do this, but I am unsure which way is actually the quickest/most efficient; hence my question:
Which text writing class is the most efficient for writing hundreds of small files ( 336 bytes on average ) to a server share?
I would recommend File.WriteAllText Method.Lesson is, let C# do it in its own way because implementers must have cared about the performance.
I tried benchmarking two functions with following code(Please feel free to suggest if you have better code):-
For a file count of
3360output was:-