Async involves some new concepts. They're not difficult; just unfamiliar. Over the past year Lucian Wischik has been watching how people use async/await in C# and VB. This series distils out the three top async patterns and anti-patterns, and top three tips for writing your own async libraries.
- Async void is for top-level event-handlers only, and event-like things. Don't use it elsewhere in your code.
- It's crucial to distinguish CPU-bound work (should be done on threadpool) from IO-bound work (which needn't).
- Async library methods should have chunky async APIs not chatty. But if chatty is unavoidable, know about these micro-optimizations to reduce heap allocation overheads.
- Async library methods should consider task.ConfigureAwait(false) to reduce their impact on the UI message queue.