Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Created July 10, 2015 23:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save EgorBo/0659e8e1b42ea72190b7 to your computer and use it in GitHub Desktop.
dispatcher performance
private Stopwatch _stopwatch = new Stopwatch();
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
ThreadPool.QueueUserWorkItem(_ =>
{
_stopwatch.Start();
Dispatcher.Invoke(() =>
{
_stopwatch.Stop();
MessageBox.Show("elapsed: " + _stopwatch.ElapsedTicks);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment