Skip to content

Instantly share code, notes, and snippets.

@robfe
Created March 1, 2011 11:26
Show Gist options
  • Save robfe/848998 to your computer and use it in GitHub Desktop.
Save robfe/848998 to your computer and use it in GitHub Desktop.
Silverlight compatible version of https://gist.github.com/460096
public class CodeTimer : IDisposable
{
readonly string message;
readonly DateTime start;
public CodeTimer(string message)
{
this.message = message;
start = DateTime.UtcNow;
}
public void Dispose()
{
DateTime end = DateTime.UtcNow;
Debug.WriteLine("{0} took {1} msec", message, (end - start).TotalMilliseconds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment