This project has moved and is read-only. For the latest updates, please go here.

CancellationToken & AsyncLazy

May 2, 2014 at 3:52 PM
Is there a way to add the handling of CancellationToken with AsyncLazy? Let's say I want the lazy factory to be cancelled if the request doesn't need it anymore?

May 2, 2014 at 6:31 PM
You can pass a CancellationToken into the factory method. However, be aware that if the factory method is canceled, then the resource creation will be canceled. All code awaiting that instance will throw an OperationCanceledException.