Registers a delegate that will be called when this System.Threading.CancellationToken is canceled.
- callback
- The delegate to be executed when the System.Threading.CancellationToken is canceled.
- state
- The state to pass to the callback when the delegate is invoked. This may be null.
The System.Threading.CancellationTokenRegistration instance that can be used to deregister the callback.
If this token is already in the canceled state, the delegate will be run immediately and synchronously. Any exception the delegate generates will be propogated out of this method call.
The current System.Threading.ExecutionContext, if one exists, will be captured along with the delegate and will be used when executing it.