C
C#2w ago
eid

✅ CancellationTokenSource .. apply what design pattern?

i notice it's object wrap other object(cancellation-token),to prevent it to set its flag in the background threads,and it is the responsible for manage it(cancel it by set it true,callback method,timeout method,etc), what the name of that design in c#?
1 Reply
SleepWellPupper
Are you asking for the name of classes that manage other class instance internals? I don't know if there is a name for that pattern, in the case of CancellationTokenSource, there is nothing special to it, it is just a "source" to grab tokens off of. Just like @TeBeCo et al. explained in https://discord.com/channels/143867839282020352/1253487978148266026