//public static myMsg DoSomething() public static long DoSomething(int load) { //Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); Stopwatch timer = new Stopwatch(); timer.Start(); Console.WriteLine("***Before calling DoLongRunningTask() " + timer.ElapsedMilliseconds); Console.WriteLine("GetHashCode " + timer.GetHashCode()); DoLongRunningTask(load); timer.Stop(); long elapsed = timer.ElapsedMilliseconds; Console.WriteLine("from DoSomething " + elapsed); return(elapsed);//return new myMsg(timer.ElaspedMilliseconds); }
//public static myMsg DoSomething() public static long DoSomething(int load) { Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); //usage of either prev or following 2 lines produce the same results //Stopwatch timer = new Stopwatch(); //instead of prev .StartNew(); //timer.Start();// instead of prev .StartNew(); Console.WriteLine("***Before calling DoLongRunningTask() " + timer.ElapsedMilliseconds); Console.WriteLine("GetHashCode " + timer.GetHashCode()); DoLongRunningTask(load); timer.Stop(); long elapsed = timer.ElapsedMilliseconds; Console.WriteLine("from DoSomething " + elapsed); return(elapsed);//return new myMsg(timer.ElaspedMilliseconds); }