using System;using System.Collections.Generic;using System.Text;using System.Threading; namespace _6_1{ class Program { int i = 0; static void Main(string[] args) { //thread 类的构造函数将threadstart 委托的实例作为唯一参数 Thread t = new Thread(new ThreadStart(new Program().calculate)); t.Start();//线程实例话后,用start方法让它运行起来 } public void calculate() { Console.WriteLine("the value of i is {0}",++i); } }}

评论