c#线程 传 单个参数
2017-06-12 12:39 伟大的程序员2 阅读(166) 评论(0) 收藏 举报 1.定义线程启动的函数,如 private static void fun(object obj) { Console.WriteLine("Hello, {0}!",obj.ToString ()); } 2.引用所需的动态库,如下
using System;
using System.Collections.Generic; using System.Text; using System.Threading; 3.主函数进行调用:
public static void Main() { Thread t = new Thread(new ParameterizedThreadStart(fun)); t.Start("lilei"); Console.ReadLine(); }
浙公网安备 33010602011771号