有谁知道如何将多个参数传递给Thread.Start例程?
我想扩展类,但C#Thread类是密封的.
以下是我认为代码的样子:
...
Thread standardTCPServerThread = new Thread(startSocketServerAsThread);
standardServerThread.Start( orchestrator, initializeMemberBalance, arg, 60000);
...
}
static void startSocketServerAsThread(ServiceOrchestrator orchestrator, List<int> memberBalances, string arg, int port)
{
startSocketServer(orchestrator, memberBalances, arg, port);
}
Run Code Online (Sandbox Code Playgroud)
顺便说一下,我用不同的协调器,天平和端口启动了许多线程.请考虑线程安全.