Task. Cancel Method
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.