On API call, we usually get data from database or through Http request. Here in our API call, we get custom list of records and we add to console and check the results
when we run through postman, we can get those results and the console output results


Now , lets cancel the request in postman and check the output results

Now i cancelled the request but still the results are returned

To save the resources returning the results we can use cancellation token.

Now when we cancel a request, it will throw TaskCancelledException
By using this we are saving resources and thread pools and saving time by not running the task
Code in my Github: https://github.com/pbndru/Phani.CancellationToken
loved the article
LikeLike