有关线程的问题 [英] question relating threading
本文介绍了有关线程的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好...我想知道为什么我们在创建线程时不能使用2个构造函数... ?????
hello... i wanted to know why we cant use 2 constructors while creating threading...?????
推荐答案
几秒后谷歌搜索我发现了这个:
在C#中向线程发送多个参数 [ ^ ]
编辑:
此外,你可以有创意。我不确定这是否会以任何方式帮助您,但如果您使用数组或参数列表,该怎么办?我不确定你是否可以将它们转换为对象,但如果可以的话,你会有类似的东西:
After a few seconds of Googling I found this:
Send multiple parameters to a thread in C#[^]
Also, you can just be creative. I am not sure if this will help you in any way but what if you used an array or a list for the parameter. I am not sure if you can convert those to objects, but if you could, you would have something like:
int ParamaterOne = 2;
string ParameterTwo = "Hello World!";
List<object> ListOfParamaters = new List<object>();
ListOfParamaters.Add(ParamaterOne);
ListOfParamaters.Add(ParamaterTwo);
object TheParamater = (object)ListOfParamaters;
你可以在螺纹空隙中将它们转换回来:
You could in the threaded void you could convert them back:
List<object> TheList = (List<object>)Paramater;
hello... i wanted to know why we cant use 2 constructors while creating threading...?????
这篇关于有关线程的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文