SAMPLE CODE
int id = 123;
ThreadPool.QueueUserWorkItem(state => ThreadEntryPoint((int)state), id);
public void ThreadEntryPoint(int uniqueId)
{
Console.WriteLine("uniqueId=" + uniqueId);
}
QUESTION
From the provided LAMBDA expression, how does the compiler know that it needs to create an instance of QueueUserWorkItem(WaitCallback, Object)
?
More specifically: I understand that it is inferring the delegate type. What I don't understand is what decision tree (from a high level) is it going through to select the correct delegate type to instantiate?
REFERENCES
- ThreadPool.QueueUserWorkItem
ThreadPool.QueueUserWorkItem(WaitCallback, Object)
- WaitCallback Delegate
QueueUserWorkItem(WaitCallback, Object)
QueueUserWorkItem(WaitCallback)
Aucun commentaire:
Enregistrer un commentaire