- state
- Documentation for this section has not yet been entered.
System.Threading.WaitCallback represents a callback method that you want to execute on a System.Threading.ThreadPool thread. Create the delegate by passing your callback method to the System.Threading.WaitCallback constructor. Your method must have the signature shown here.
Queue your task for execution by passing the System.Threading.WaitCallback delegate to ThreadPool.QueueUserWorkItem(WaitCallback, object). Your callback method executes when a thread pool thread becomes available.
[Visual Basic]
Visual Basic users can omit the System.Threading.WaitCallback constructor, and simply use the AddressOf operator when passing the callback method to ThreadPool.QueueUserWorkItem(WaitCallback, object). Visual Basic automatically calls the correct delegate constructor.
If you want to pass information to your callback method, create an object that contains the necessary information and pass it to ThreadPool.QueueUserWorkItem(WaitCallback, object) when you queue your task for execution. Each time your callback method executes, the state parameter contains this object.
For more information about using callbacks to synchronize thread pool threads, see [<topic://cpconthreadpooling>].