I\'m looking for a rationale of why .NET CancellationToken
struct was introduced in addition to CancellationTokenSource
class. I understand how
The CancellationToken
is a struct so many copies could exist due to passing it along to methods.
The CancellationTokenSource
sets the state of ALL copies of a token when calling Cancel
on the source. See this MSDN page
The reason for the design might be just a matter of separation of concerns and the speed of a struct.