0
這似乎不直觀的對我說:CancellationTokenSource的TaskCompletionSource取消不會更新Task.Status?
var cts = new CancellationTokenSource();
cts.Cancel();
var tcs = new TaskCompletionSource<int>();
try
{
tcs.Task.Wait(cts.Token);
}
catch (OperationCanceledException)
{
Console.WriteLine(tcs.Task.Status); //TaskStatus.WaitingForActivation
}
我希望它更新狀態TaskStatus.Canceled
。將它留在TaskStatus.WaitingForActivation
的理由是什麼?