多参数线程

有人知道如何将多个参数传递到一个线程中吗

我曾想过扩展这个类,但C#Thread类是密封的

我认为代码应该是这样的:

。。。
线程标准TcpServerThread=新线程(StartSocketServerAshread);
standardServerThread.Start(orchestrator,初始化MemberBalance,arg,60000);
...
}
静态void startSocketServerAshread(ServiceOrchestrator orchestrator,列表<int>成员余额,字符串arg,int端口)
{
startSocketServer(orchestrator、memberBalances、arg、port);
}

顺便说一句,我使用不同的编排器、平衡和端口启动了许多线程。请考虑线程安全性。

尝试使用lambda表达式捕获参数

线程标准TcpServerThread=
新线程(
未使用=>启动SocketServerAshread(初始化MemberBalance,arg,60000)
);

发表评论