读书人

C#中以类的实例作为线程参数应该如何操

发布时间: 2012-08-21 13:00:21 作者: rapoo

C#中以类的实例作为线程参数应该怎么操作
尝试过使用“ParameterizedThreadStart”以及“创建线程实现类”两种方式进行线程参数传递
string型参数可以正常传递
当传递类的实例时总是出问题,请指点一下应该怎样操作,给些方向性的建议也可以,谢谢!

[解决办法]

C# code
private void Proc(object obj){    List<int> list = (List<int>)obj;}// 线程调用List<int> list = new List<int>();Thread thread = new Thread(new ParameterizedThreadStart(Proc));thread.Start(list);
[解决办法]
探讨
引用:

C# code
private void Proc(object obj)
{
List<int> list = (List<int>)obj;
}

// 线程调用

List<int> list = new List<int>();

Thread thread = new Thread(new ParameterizedThreadStart……

[解决办法]
探讨
引用:

C# code
private void Proc(object obj)
{
List<int> list = (List<int>)obj;
}

// 线程调用

List<int> list = new List<int>();

Thread thread = new Thread(new ParameterizedThreadStart……

[解决办法]
探讨
引用:

引用:
引用:

C# code
private void Proc(object obj)
{
List<int> list = (List<int>)obj;
}

// 线程调用

List<int> list = new List<int>();

Thread thread = new Thread(……

[解决办法]
C# code
//是这个意思吗?void start(){   ThreadStart starter = delegate { dtChanger(dataset1); };//线程带参数   new Thread(starter).Start();}void dtChanger(DataSet dataset1){    //事件} 

读书人网 >C#

热点推荐