Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created November 12, 2017 13:31
Show Gist options
  • Save luisdeol/1bbf29384c0b458fafb198e991c9b682 to your computer and use it in GitHub Desktop.
Save luisdeol/1bbf29384c0b458fafb198e991c9b682 to your computer and use it in GitHub Desktop.
Foreground and Background Threads
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