Created
November 12, 2017 13:31
-
-
Save luisdeol/1bbf29384c0b458fafb198e991c9b682 to your computer and use it in GitHub Desktop.
Foreground and Background Threads
This file contains 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
namespace MultiThreadingExamples | |
{ | |
public static void UltraCoolMethod() | |
{ | |
const int iterationNumber = 10; | |
for (var i = 0; i < iterationNumber; i++) | |
{ | |
Console.WriteLine($"Execution Thread Nº {i}"); | |
Thread.Sleep(0); | |
} | |
} | |
static void Main(string[] args) | |
{ | |
Thread theThread = new Thread(UltraCoolMethod); | |
theThread.IsBackground = true; | |
theThread.Start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment