You can simply specify a parameter for the lambda expression and ignore it:
ThreadPool.QueueUserWorkItem(ignored =>
{
while(!paused)
{
ThreadPool.QueueUserWorkItem(alsoIgnored => {...});
}
});
Or use an anonymous method:
ThreadPool.QueueUserWorkItem(delegate
{
while(!paused)
{
ThreadPool.QueueUserWorkItem(delegate {...});
}
});
If you do not need parameters for anonymous methods, you do not need to specify them.
source
share