For Asynchronous understanding, asynchronous
Previously, I was confused about Synchronous methods and asynchronous Methods Using async and await. I think what is the difference between the asynchronous and synchronous Methods waiting for execution results? Their execution order is the same?
Don't all need to wait for execution results? Today, I flipped through C # advanced programming to figure out the difference. The async and await Asynchronization won't block the thread.
First, let's talk about the differences between the synchronous method and the Asynchronous Method. For example, if a web site loads some network resources and uses synchronous requests, the user interface of the web site will be blocked,
The method is used to call the network of the resource and analyze the result. The time required to complete these calls depends on the network speed and the current workload of the server. It is unpleasant for users to get disconnected and wait for a period of time.
So use Asynchronous call. Asynchronization can avoid blocking, and more things can be done during this period. However, Asynchronization has a defect. Compared with synchronization, it is full of uncertainty about the process of the program, and the order may be reversed.
In some scenarios, for example, when multiple asynchronous methods are called, they are dependent. The subsequent asynchronous methods must use the results of the previous Asynchronous Method, we need to call these asynchronous methods in order,
In this case, the async and await keywords are used to wait for the execution result, but it does not block the thread.