Introduction Task.Delay is a method in the .NET framework that creates a task that completes after a specified time period. Asynchronous programming often uses this method to introduce a delay…
Asynchronous Testing with NUnit and C#
Introduction Asynchronous programming has become a cornerstone in modern software development, particularly in C#. Its ability to improve application performance and responsiveness is unparalleled. However, with great power comes great…
Choose await/async over Task Alone
Introduction In C#, async/await and Task serve different purposes when it comes to asynchronous programming. async/await is a language feature that simplifies asynchronous code, while Task represents a unit of…
To Pass or Not To Pass a Cancellation Token
Introduction In C#, when working with asynchronous operations that support cancellation, it's a good practice to pass a CancellationToken when appropriate. However, whether you should always pass a CancellationToken depends…
Making Methods Async
Introduction In C#, you can use the async and await keywords to create asynchronous methods. However, not all methods can be easily turned into asynchronous methods using async Task. Whether…
Avoid async void
Introduction Asynchronous programming is a crucial aspect of modern software development, allowing applications to perform non-blocking operations and maintain responsiveness. In C#, asynchronous programming is accomplished using the async and…
Advanced Use of Async Cancellation Tokens in C#
Introduction In C# asynchronous programming, cancellation tokens are a core feature used to manage the lifetime of asynchronous operations. They provide a cooperative cancellation mechanism, allowing tasks to be cancelled…
Understanding Async in C#
Introduction Asynchronous programming is a critical aspect of modern software development, particularly in I/O-bound, database and network-bound operations. In C#, async and await keywords are used to simplify the writing…