Click here to Skip to main content
15,868,134 members
Articles / Programming Languages / C#

How to Use the C# Await Keyword on Anything

Rate me:
Please Sign up or sign in to vote.
4.91/5 (30 votes)
24 Jul 2020MIT7 min read 39.9K   274   53  
Using await in scenarios where you want to await custom items with or without using Task.Run()
Await can be used on things other than Task objects - it's simply a matter of implementing the members the compiler wants. Here, I endeavor to explain how to await anything using custom awaitable objects and also using TaskAwaiter.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
United States United States
Just a shiny lil monster. Casts spells in C++. Mostly harmless.

Comments and Discussions