Last active
February 2, 2016 09:34
-
-
Save kmteam/49ae6c6b60ffbfc5c875 to your computer and use it in GitHub Desktop.
Mesure time Consumption of pice of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Mesure time compsumption of piece of code | |
/// </summary> | |
/// <param name="action">Method to test (must be a method without parameters)</param> | |
/// <returns></returns>private TimeSpan Mesure(Action action) | |
public static TimeSpan Mesure(this Stopwatch watch,Action action) | |
{ | |
watch.Start(); | |
action(); | |
watch.Stop(); | |
return watch.Elapsed; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment