I was just writing a very simple little console app to move data from one file to another (under certain conditions) and I thought it would be beneficial if the output gave some feedback that something was happening.
So, for each file, for every 10,000 lines processed, I put a "." out via Console.Write Seems simple enough, but I was wondering how you would go about determining that you got through 10,000 lines? Here was my approach: int counter=0; while ((line = fs.ReadLine()) != null) { // do stuff - snipped counter++; if ((int)(counter/10000)*10000 == counter) { Console.Write("."); } } This works fine in my application, but I was wondering what different approaches were available, especially considering there is a bit of wasted math here, seems like it could be costly for a very long running process. (In my situation, the app will be processing many millions of rows of data, so small savings could add up to a big net saving.) Cheers, Dylan Tusler ------------------------------------------------------------------------------------------------- To find out more about the Sunshine Coast Council, visit your local council office at Caloundra, Maroochydore, Nambour or Tewantin. Or, if you prefer, visit us on line at www.sunshinecoast.qld.gov.au This email, together with any attachments, is intended for the named recipient(s) only. Any form of review, disclosure, modification, distribution and or publication of this email message is prohibited without the express permission of the author. Please notify the sender immediately if you have received this email by mistake and delete it from your system. Unless otherwise stated, this email represents only the views of the sender and not the views of the Sunshine Coast Regional Council. maile 3_0_0