Created
January 6, 2015 15:44
-
-
Save nasal/10f1f67e49c1b7f717c2 to your computer and use it in GitHub Desktop.
C#: Simple thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Thread(delegate() | |
{ | |
Dispatcher.BeginInvoke(new Action(delegate() | |
{ | |
// Do something in the "main" thread (the thread calling the new thread). | |
})); | |
// Do whatever you want. | |
Thread.Sleep(3000); | |
Dispatcher.BeginInvoke(new Action(delegate() | |
{ | |
// Do something else in the "main" thread. | |
})); | |
}).Start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment