When can CancellationToken.CanBeCanceled be false? When can CancellationToken.CanBeCanceled be false? multithreading multithreading

When can CancellationToken.CanBeCanceled be false?


Well, CancellationToken.None returns one that isn't cancellable.

If you're the user of an API that insists on receiving a CancellationToken, but you've got no interest in ever attempting to cancel the work, then you could just pass it this token.

As someone building an API, you may be able to make certain optimizations if CanBeCancelled returns false - maybe it's "expensive" for you to check the IsCancellationRequested property.