I modifed your code slightly
[CS]
StreamWriter Results = new StreamWriter("C:\\TimeResults.txt");
this.Text = "Starting...";
DateTime Start = DateTime.Now;
DateTime TryStart = DateTime.Now;
TimeSpan Difference;
for (int x = 0; x < 1000; x++)
{
try
{
TryStart = DateTime.Now;
Application.DoEvents();
StreamReader Test = new StreamReader("r:\\birthcrt\\999\\9995\\9995000M.txt");
Test.Close();
Test.Dispose();
}
catch
{
Difference = DateTime.Now.Subtract(TryStart);
Results.WriteLine(x.ToString().PadRight(6, (char)32) + Difference.TotalMilliseconds.ToString());
}
}
Difference = DateTime.Now.Subtract(Start);
Results.WriteLine("DONE " + Difference.TotalMilliseconds.ToString());
Results.Close();
Results.Dispose();
this.Text = "Finished...";
[/CS]
The mods allow me to see the time it took for each individual try when trying to open a file on the network drive.
I wanted to simulate stuff actually going on with the system while it was tring to run. So while it was running the simulation I was opening and closing stuff on the desktop.
Quickest was 0mSecs and slowest was ~47mSecs with an average of 6.4mSecs for the 1000 samples. Total time was ~6 seconds. So not slow enough that it would not be noticed. Especially since I will be introducing a wait time between each pass.
Thanks
Brian