C#

Moving from Event-based asynchronous pattern (EAP) to Task-based asynchronous pattern (TAP) with cancellation

Posted on
cs-async-logo

What’s the point of this blog post? In modern C#/.NET ecosystem there is encouragement to use async/await Task based asynchronous model over other asynchronous patterns and approaches. On the other side, there are still a lot of libraries (legacy, wrappers from other technologies/languages which uses events for callback calls, etc…) which use older EAP approach […]

.Net Core

C#: From Event-based Asynchronous Pattern to Task-based Asynchronous Pattern

Posted on
cs-async-logo

Task-based Asynchronous Pattern (TAP) was introduced in .NET Framework 4 and since then, it is the recommended approach to asynchronous programming in .NET.

Event-based Asynchronous Pattern (EAP) is still in use, especially at legacy systems, but for new development is not recommended anymore.

In this post I will show how to wrap EAP into TAP and use more modern approach.

.Net Core

C# locks and async Tasks.

Posted on

C# lock is mechanism to prevent concurrent access to “restricted” resource in multi-threaded environment. In multi-threaded applications locks are used to ensure that the current thread executes a block of code to completion without interruption by other threads. The lock statement obtains a mutual exclusion lock for a given object so that one thread executes […]