July 2019
Intermediate to advanced
410 pages
10h 32m
English
Asynchronous programming is very helpful in cases where we are expecting various activities at the same point in time. With the async keyword, we define our method/operation as asynchronous. Consider the following code snippet:
internal class AsyncAwait{ public async Task ShowMessage() { Console.WriteLine("\tServing messages!"); await Task.Delay(1000); }}
Here, we have a AsyncAwait class with an async method, ShowMessage(). This method is simply printing a message that would show in the console window. Now, whenever we call/consume this method in another code, that part of the code could wait/hold/block the operation until the ShowMessage() method executes and completes its task. Refer to the following snapshot: ...
Read now
Unlock full access