05用线程类Thread开启线程

1.,密封类不能被继承 (thread)
l类的内部的开启了,没有参数

2.要有参数 一定是object类型,(记住了)

3.自己创造线程 没有参数的时候

4.自己创造线程 有参数

 用Thread开启线程,在unity可用,线程随眠,可以代替Time.Timescale=0.。

 

 1  static void Main(string[] args)
 2         {
 3             //Thread thread = new Thread(Text);
 4             //thread.Start("123");
 5             MyThread my = new MyThread();
 6             Thread thread = new Thread(my.GetThread);
 7             thread.Start("123");
 8         }
 9         public static void Text(object num) {
10 
11            //  Thread.Sleep(100);
12             Console.WriteLine("这是测试方法"+num);
13 
14         }

 

posted @ 2018-09-27 09:46  白纸菇凉  阅读(277)  评论(0编辑  收藏  举报