no dogma blog
no dogma blog
Blog Posts
Podcast
Web API Lambda Course
Polly Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
async
Putting Tasks in a Cache, and Computing Only Once, When First Requested
Caches are usually used to store concrete values, but with C# you can store tasks for work you want to perform only once, at the time the key is first requested from the cache.
Mar 19, 2025
#
Cache
,
Task
,
MemoryCache
,
async
,
WebApi
Create a Task and Start it Later
I usually want to run a task immediately, but there are times when I want to create a task, but not start it until later. This post will show you how to do defer execution of a task.
Mar 14, 2025
#
C#
,
.NET
,
Task
,
async
Throw ThrowIfCancellationRequested in a Method that Returns a Value when Using a Cancellation Token
When sending a cancellation request to a method that returns a value, you must return a value or throw an exception. Here is how to throw the exception.
Jan 3, 2024
#
C#
,
dotNet
,
async
,
CancellationToken
Simple Cancellation Token Example
Here is an example of using a cancellation token to stop the execution of a method.
Dec 28, 2023
#
C#
,
dotNet
,
async
,
CancellationToken
Priority Queues and Async Tasks
Priority queues are new to .NET 6. Here is a simple example using them to “schedule” async tasks.
Nov 24, 2021
#
dotNet
,
C#
,
async
,
Priority Queue
Cite
×