Click here to Skip to main content
15,891,864 members
Articles / Programming Languages / C#

How To: Measure execution time in C#

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
9 Mar 2011CPOL 9.6K   1  
Please try this method to get execution time. I'm not sure that it is very accurate.public static TimeSpan GetDuration(Stopwatch sw, ThreadStart method){ sw.Reset(); sw.Start(); method(); sw.Stop(); return sw.Elapsed;}you can put it into any common static class and use as...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions