If you use the standard .Net libraries and do something like this (in the catch try block):
using (StreamWriter writer = new StreamWriter("filenumber1.txt")) { writer.Write("This is a test");
Performance must be reasonable. When writing to a file, just keep the lines in a decent size (read and write and fragments, if necessary) to avoid memory problems. For example, if the data making up the file is 10 gigabytes, you will need to write the lines in pieces.
I once had to read the 1000th drops in the database and push them to distribution servers in the file system. My initial approach was one read and write. That was good, then I used a multi-threaded approach and got decent performance.
First, I would take one approach to the operation and perform some actions. If it takes X the amount of time, and everyone is happy, done. If you need to do Y, implement a multi-thread approach.
Just notice, I would make the number of threads customizable so that performance can be implemented. Too many threads and it slows down. You need to find a sweet spot, so make it customizable. This usually depends on the hardware.
Jon raynor
source share