I’m trying to use that method this way:
public void Method()
{
ThreadPool.QueueUserWorkItem(() =>
{
while(!paused)
{
ThreadPool.QueueUserWorkItem(() => {...);
}
});
}
}
The problem comes cause it throws me a compilation error in the first call.
error CS1593: Delegate
System.Threading.WaitCallback' does not take0′ arguments
Any idea of how to do it without arguments? , any alternative?
You can just provide a parameter for the lambda expression, and ignore it:
Or use an anonymous method instead:
If you don’t care about parameters for anonymous methods, you don’t have to state them.