C# guides
Every published C# guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular C# guides
Most readLatest C# guides
Page 10 of 77C# 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.
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.
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.
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.
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.
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.
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.
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.
C# async lambda: Syntax, Behavior, and Pitfalls
C# async lambda syntax lets you use await inside a delegate. This guide explains where async lambdas are allowed and how to avoid common runtime pitfalls with exceptions, LINQ, and concurrency.
C# Task vs ValueTask: Choosing the Right Async Return Type
Understanding the differences between Task and ValueTask in C#, when each return type is appropriate, and how ValueTask can reduce allocations in performance-sensitive code.