Browse by Topic

Popular

Latest

Latest C# Posts

Illustration of C# await using for asynchronous resource disposal with a shield and clock metaphor.
C#

C# await using: Asynchronous Resource Disposal

Learn how to use C# await using to dispose IAsyncDisposable resources asynchronously, with syntax, examples, and practical guidance.

IAsyncDisposableasync disposalresource managementC# using
Editorial illustration of an async iterator state machine streaming values from an asynchronous operation to a consumer loop.
C#

Using async yield return in C#

Combine async and yield return in C# with IAsyncEnumerable<T>. Learn await foreach, cancellation, error handling, and streaming behavior.

IAsyncEnumerableasync/awaitC# iteratorsawait foreach
Illustration of a C# async iterator streaming values with yield return and await foreach
C#

C# Async Iterator: yield return and await foreach

c# async iterator: Learn how to create and consume C# async iterators using IAsyncEnumerable, yield return, and await foreach with practical examples.

C#AsyncIAsyncEnumerableyield return
Illustration of an asynchronous stream being consumed by a foreach loop with an await keyword, symbolizing c# await foreach.
C#

Using C# await foreach with IAsyncEnumerable

Learn how to consume and produce asynchronous streams with C# await foreach, including cancellation, error handling, and runtime requirements.

async streamsIAsyncEnumerableC# 8asynchronous programming
Illustration of a C# async stream pipeline with data flowing through sequential processing stages
C#

Using C# IAsyncEnumerable for Async Streams

Learn how to produce and consume async streams with C# IAsyncEnumerable, including await foreach, cancellation, error handling, and resource management.

C#async/awaitstreamingIEnumerable
Illustration of a C# async enumerable streaming data items from a source to a consumer with await foreach.
C#

Using C# Async Enumerable for Streaming Data

Learn how to create and consume async enumerables in C# using IAsyncEnumerable<T> and await foreach, including cancellation and resource management.

IAsyncEnumerableasync streamsawait foreachC# async
Illustration of a C# task cancellation flow showing a CancellationTokenSource signaling a running task to stop.
C#

C# Task Cancellation: Using CancellationToken Correctly

Learn how to implement cooperative cancellation in C# tasks with CancellationTokenSource and CancellationToken, handle OperationCanceledException, and avoid common pitfalls.

CancellationTokenasync-awaitTask.NET
Illustration of a C# CancellationToken stopping an async operation with a cancel button and a task pipeline.
C#

C# CancellationToken: How to Cancel Operations Gracefully

Understand how to use C# CancellationToken to cancel async and sync operations gracefully, handle OperationCanceledException, and combine tokens with timeouts.

CancellationTokenAsync ProgrammingTaskCooperative Cancellation
Illustration of a try-catch block wrapping an async operation in C# with an await expression.
C#

Handling Exceptions in C# Async Methods with try/catch

Learn how to use try/catch with async methods in C#: exception propagation, async void risks, exception filters, and practical retry and cleanup patterns.

asyncexception-handlingtry-catchawait
Illustration of exception handling in C# async methods with try-catch blocks and Task objects.
C#

C# Async Exception Handling: Patterns That Work

Learn how exceptions propagate in C# async methods and how to catch them reliably with await, Task.WhenAll, async void, and cancellation scenarios.

asyncexception handlingTaskawait