Implementing an Asynchronous Method
Important Points
- A task represents an asynchronous operation;
- We can use the
async
keyword to convert a method into an asynchronous method; - An asynchronous method always returns a
Task
object; - In order to return data from an asynchronous method, we use the
Task<T>
as the method's return value, whereT
is the datatype of the return value; - The
await
keyword waits for an asynchronous task to be performed.
1. What does the async keyword do in C#?
2. What keyword is used to pause a method until an asynchronous operation is complete?
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.22
Implementing an Asynchronous Method
Swipe to show menu
Important Points
- A task represents an asynchronous operation;
- We can use the
async
keyword to convert a method into an asynchronous method; - An asynchronous method always returns a
Task
object; - In order to return data from an asynchronous method, we use the
Task<T>
as the method's return value, whereT
is the datatype of the return value; - The
await
keyword waits for an asynchronous task to be performed.
1. What does the async keyword do in C#?
2. What keyword is used to pause a method until an asynchronous operation is complete?
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2