Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.