Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Created July 10, 2015 23:35
Show Gist options
  • Save EgorBo/0659e8e1b42ea72190b7 to your computer and use it in GitHub Desktop.
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