When the execution reaches await, the task will be executed in another thread and while the main thread waiting for the response of that thread, it can treat other tasks. Imagine a web server, an Async task might be reading data from the database, while the data is being fetched, the main thread is not waiting for the database response, it can handle other incoming requests and when the database responds, the web server resumes its execution after the await keyword.
"asynchronous" doesn't necessarily mean that code is running concurrently or in parallel. Instead, it refers to the ability to handle operations that might take some time to complete without blocking the execution of the rest of the code. to operate this operation some methods are defined and "ASYNC and AWAIT" is the one method....
Let's say you have a http server running on a new thread. How can I have methods that call a function that needs to run on the main thread from the HTTP server thread?
I appreciate the value of your informative videos.
Glad you like them! @ funwithriyu9693
how it is called asynchronous if it is waiting for the result. I did not understood
When the execution reaches await, the task will be executed in another thread and while the main thread waiting for the response of that thread, it can treat other tasks. Imagine a web server, an Async task might be reading data from the database, while the data is being fetched, the main thread is not waiting for the database response, it can handle other incoming requests and when the database responds, the web server resumes its execution after the await keyword.
"asynchronous" doesn't necessarily mean that code is running concurrently or in parallel. Instead, it refers to the ability to handle operations that might take some time to complete without blocking the execution of the rest of the code. to operate this operation some methods are defined and "ASYNC and AWAIT" is the one method....
Me too
@@imhassanehow many threads works here
Awesome videos bro. I was watching all your videos for the last couple of months. Thanks for all your videos 🙏
Glad you like them and thanks @tcanbarasan
i think this is the best explanation
Nice!
Why not simply,
Var i= method1();
Int j = method2(i);
Normally It advances only if line 1 is completed, right?
Let's say you have a http server running on a new thread. How can I have methods that call a function that needs to run on the main thread from the HTTP server thread?
Is this java or js? The structure of code is like java but the syntaxs are like js, anyway this is good explanation sir
It is C#
@@yokeshchowdary1550oh
Can you please start these types of videos for SQL server as well?
Sure will try @mohammedshahid8303
@@interviewhappy thanks
Keep doing more videos on the web api sir
Sure 👍 will do @lakshmi2961
@@interviewhappy I learned c# from your short videos. Sir really you are a good teacher sir, thank you sir
bot channel