I'm trying to come up with a method which will measure and return the execution time of another method. Basically something like this:
public void DoSomething(Int32 aNumber) { /* Stuff happens */ } // // Somewhere else in code: TimeSpan executionTime = MyDiag.MeasureExecTime(DoSomething(5)); // Now executionTime contains how long DoSomething(5) took to execute, // e.g. 2.55463 seconds. How can I do this (the MeasureExecTime method)?