Difference between revisions of "Background and foreground threads"
From MyWiki
(Created page with "<source lang="csharp"> using System; using System.Threading; namespace Chapter1 { public static class Program { public static void ThreadMethod() {...") |
(No difference)
|
Latest revision as of 21:17, 23 June 2014
using System; using System.Threading; namespace Chapter1 { public static class Program { public static void ThreadMethod() { for (int i = 0; i < 10; i++) { Console.WriteLine("ThreadProc: {0}", i); Thread.Sleep(1000); } } public static void Main() { Thread t = new Thread(new ThreadStart(ThreadMethod)); t.IsBackground = true; t.Start(); } } }