gpt4 book ai didi

c# - 使用两个参数来线程化子进程?

转载 作者:行者123 更新时间:2023-12-02 22:58:18 26 4
gpt4 key购买 nike

Possible Duplicate:
thread with multiple parameters

如何使用两个参数来线程化子进程?

我想像这样线程化我的子程序,但它出现了错误:

Thread t = new Thread (subname);
t.Start()

错误如下:

Argument 1: cannot convert from 'method group' to 'System.Threading.ParameterizedThreadStart'

The best overloaded method match for 'System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)' has some invalid arguments

这是我的子外观:

    public string send2(string kom, string ddm)
{

///code for a httpwebrequest (too long to post all of it)


}

你们有什么解决办法吗?

最佳答案

您可以使用 lambda:

...
string kom = ...
string ddm = ...

Thread t = new Thread( () => send2( kom, ddm ) );

关于c# - 使用两个参数来线程化子进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9142628/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com