CSharp examples for Thread Asynchronous:Task
Manually Induced Cancellation
using System;/*from ww w. j a va 2 s . com*/ using System.Threading.Tasks; class ManuallyInducedCancellation { static void Main() { Task task = ThrowCancellationException(); Console.WriteLine(task.Status); } static async Task ThrowCancellationException() { throw new OperationCanceledException(); } }