Measure Method Time Performance

Standard

Quick snippet to let you check the time used by any method you have.

This will write to the console the time spent on the method.

Just remember to use System.Diagnostics.
More info on Stopwatch.

That’s it. Enjoy.

  • PeterBobPeter

    Keep in mind that you have an overhead like this, especially when you have a method that accepts arguments.

    You should really mention that in your post.

    • Hello PeterBobPeter,

      How would you measure performance? Would it be better to have the stopwatch, inside the method?

      Cheers.