While using a profiler is a great way to time the execution (as well as memory) for method executions in your code, I thought I would like to have some generic way to time the executions of my methods.
The end result is pretty simple but may not be the best way to do it. Definitely not as generic as I wanted it to be. But this would work for some performance testing of algorithms.
The code for the TimeAndExecute() method is shown below.
The usage is also simple.
Pretty simple huh!