Task. Cancel Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Instructs the task to exit as soon as possible, or to immediately exit if Execute is invoked after this method.
public: void Cancel();
public void Cancel ();
abstract member Cancel : unit -> unit
Public Sub Cancel ()
Cancel() may be called at any time after the task has been instantiated, even before Execute() is called. Cancel calls may come in from any thread. The implementation of this method should not block indefinitely.