C# thread with multiple parameters
- by Lucas B
Does anyone know how to pass multiple parameters into a Thread.Start routine?
I thought of extending the class, but the C# Thread class is sealed.
Here is what I think the code would look like:
...
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);
}
Thank you in advance.
BTW, I start a number of threads with different orchestrators, balances and ports. Please consider thread safety also.