private void RegisterWithSource(CancellationSource source) { if (source == null) { return; //todo: throw? } source.Register(Cancel); }
public void Register(Action callback) { if (!CanBeCanceled) { throw new Exception("Non cancellable token will never fire"); } _source.Register(callback); }