using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace 线程开启方式_通过Thread类
{
class Program
{
static void Test(object filename)
{
Console.WriteLine("开启线程方法");
}
static void Main(string[] args)
{
student1 dl = new student1(1001,"李四");//实例化一个student1对象
Thread td = new Thread(dl.OutPut);//用thread类开启线程
td.Start();//开始
Console.WriteLine("===============================");
Console.ReadKey();
}
}
//一个学生信息类
class student1
{
int Id;
string Name;
public student1(int id, string name)
{
this.Id = id;
this.Name = name;
}
public void OutPut()
{
Console.WriteLine(Id + "," + Name);
}
}
}