This Async Await in C# tutorial will acquaint you with a clear understanding of the fundamentals of C# Asynchronous programming. In this C# Tutorial for beginners, you will get better understanding on what is the Asynchronous Programming. we will start with an introduction to Asynchronous Programming,Then we will discuss the need of asynchronous Programming. then we will have the C# Async Await Explained With Example. Finally we will conclude the tutorial with differences between synchronous and asynchronous Programming.
3. Agenda
âą What is Asynchronous Programming?
âą Need of Asynchronous Programming
âą Async and Await Keyword
âą Demo
âą Asynchronous vs Synchronous Programming
5. What is Asynchronous Programming?
Using asynchronous programming, the application can work on
other tasks without waiting for the task to be completed.
Asynchronous programming is very popular in C# thanks to the
async and await keywords.
When dealing with UI, we use a long-running method like reading a
large file or something similar.
If any synchronous process is blocked, the entire application is
blocked, and our application stops responding until the task is
completed.
7. Need of Asynchronous Programming
In Synchronous Programming, compilers run one
statement and wait for it to complete and then move to
next one
In Asynchronous Programming, compilers run one
statement and while it gets completing, we will also
work on the next one
10. Async and Await Keyword
Async Keyword
Asynchronous methods are created by using the async modifier
on a method.
An async method runs synchronously until it reaches its first
await operator, at which point it suspends.
An async method runs synchronously until it reaches its first
await operator, at which point it suspends.
11. Async and Await Keyword
Await Keyword
While the asynchronous operation is running, the await operator
suspends the async method evaluation.
When the asynchronous operation completes, the await
operator returns the result.
12. Async and Await Keyword
&
If there is no await operator in the async method, the method executes
synchronously.