有趣的多线程编程(1)——一个简单的例子 - 中国WEB开发者网络 (http://www.webasp.net) -- 技术教程 (http://www.webasp.net/article/) --- 有趣的多线程编程(1)——一个简单的例子 (http://www.webasp.net/article/28/27244.htm) | |
| -- 作者:未知 -- 发布日期: 2006-02-07 | |
//HelloWordThread.csusing System; using System.Threading; public class Test { static void Main() { ThreadStart job = new ThreadStart(ThreadJob); Thread thread = new Thread(job); thread.Start(); for (int i=0; i < 5; i++) { Console.WriteLine ("Main thread: {0}", i); Thread.Sleep(1000); } } static void ThreadJob() { for (int i=0; i < 10; i++) { Console.WriteLine ("Other thread: {0}", i); Thread.Sleep(500); } } } 结果:
//UsingDelegate.cs | |
| webasp.net |