1 public class OperationTimer : IDisposable
2 {
3 private Int64 m_startTime;
4 private string m_text;
5 private Int32 m_CollectionCount;
6
7 public OperationTimer(string text)
8 {
9 m_startTime = Stopwatch.GetTimestamp();
10 m_text = text;
11 }
12
13 public void Dispose()
14 {
15 string text = string.Format("Time={0,6:###.00}", (Stopwatch.GetTimestamp() - m_startTime) / Stopwatch.Frequency);
16 Console.WriteLine(string.Format("{0}:{1}", m_text, text));
17 }
18 }