... when used with async/await.
TaskCompletionSource class is a very useful facility if you want to control the lifetime of a task manually. I share a canonical example when TaskCompletionSource is used for converting the event-based asynchronous code to the Task-based pattern.
One of the best traits of a well-designed system is composability. Large systems are complex and hierarchical and one of the best ways to fight accidental complexity is to compose a system from smaller components. You write and test each component independently then you glue them together to achieve a higher-level behavior.
Programming ...
The async series
Dissecting the async methods in C#.
Extending the async methods in C#.
The performance characteristics of the async methods in C#.
One user scenario to rule them all.
Almost every non-trivial behavior of the async methods in C# can be explained based on one user scenario: migration of the existing synchronous ...
When you write multi-threaded code, it's important to be aware of whether the code in other libraries you call into is also thread-safe. By my observation, most code written is not thread-safe. So if you're writing thread-safe code, kudos to you. But as you'll sometimes need to call non-thread-safe code from your multi-threaded code, this post...