多线程执行带参数的函数 多线程线程 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://msdn.microsoft.com/zh-cn/library/system.threading.parameterizedthreadstart(VS.80).aspx 线程传参问题,大体上有3种方式1.把线程封装到类里去,实例化类的时候,参数给类的属性,然后类里开线程2.Thread.Start(object);当然线程函数也必须定义成void function(object o){}3.委托传参 void fun2(int i1, string s1){}th2 = new Thread(delegate() { fun2(1, "1"); });th2.Start(); 根据你给出的函数,有传入的,还有out的,最后一种方式其实不太合适了可以封装成类或者定义一些数组来放传入的变量和传出的变量,然后object里传入数组的索引,线程里使用数组 threadClient[index] = new Thread(new ParameterizedThreadStart(接口函数)); threadClient[index].IsBackground = true; threadClient[index].Start(参数);你是要这样的? public void ProgressInfo(string str1, string str2) { System.Threading.Thread th = new System.Threading.Thread(() => DownLoadFace(str1, str2)); th.IsBackground = true; th.Start(); } //带参数的方法 private void DownLoadFace(string str1, string str2){ } 高手请进!!!请问如何截图??? 请教Datacontext F11调试不进入dll源代码 ORC文字识别DLL,谁提供个,我们大家交换下资源! 如何把Excel里面的图像保存为文件? 哪位大哥有winForm中的datagrid的运用的例子啊,例如新增记录啊,修改记录啊,还有删除记录啊等等这种例子啊 请问C#如果向USB设备发送HIGH信号? 求一个JQ的写法 问一个viewstate的问题 2003 与 2002 的区别? 跪求SQL 统计语句 dt.Rows[i]["民族"] = Select distinct "民族" from Orders;
1.把线程封装到类里去,实例化类的时候,参数给类的属性,然后类里开线程
2.Thread.Start(object);
当然线程函数也必须定义成void function(object o){}
3.委托传参
void fun2(int i1, string s1){}
th2 = new Thread(delegate() { fun2(1, "1"); });
th2.Start();
可以封装成类
或者定义一些数组来放传入的变量和传出的变量,然后object里传入数组的索引,线程里使用数组
threadClient[index].IsBackground = true;
threadClient[index].Start(参数);
你是要这样的?
{
System.Threading.Thread th = new System.Threading.Thread(() => DownLoadFace(str1, str2));
th.IsBackground = true;
th.Start();
} //带参数的方法
private void DownLoadFace(string str1, string str2)
{
}