- (oder der abgeleitete Ausnahmebereich wie TaskCanceledException ) wird geworfen
Code: Select all
OperationCanceledException
- ist wahr
Code: Select all
token.IsCancellationRequested
- In Delegat übergeben an OperationCanceledException ist identisch mit Token als Parameter für die Erstellung von Aufgaben
Code: Select all
token
Code: Select all
var task = Task.Run(() =>
{
throw new OperationCanceledException();
});
try
{
task.Wait();
}
catch (AggregateException)
{
Console.WriteLine(task.Status); // Cancelled
}