using System; using System.Collections.Generic; using System.Text; namespace DaoCommon { public class ElapsedTimer { long start; public ElapsedTimer() { startTimer(); //Constructor also starts the timer } public void startTimer() { start = DateTime.Now.Ticks; } public void stopAndPrint(string msg) { long stop = DateTime.Now.Ticks; long elapsed = (stop - start) / 10000; //omreg tidsforskel til millisekunder Console.WriteLine( msg + " took " + elapsed + " milliseconds "); startTimer(); //when done reset timer } } }