Asynchronous programming C#

Asked

Viewed 225 times

5

How would my application behave in a scenario where I perform an asynchronous query in the database and then manipulate the returned value? The application would wait for the query to be finalised or would continue the flow of execution normally?

int id = await GetById();

if (id == 20)
   ...

1 answer

9


Answering your question, the application will wait for the return of its function without blocking the program flow.

You use a await when in the declaration of your method has the keyword async leaving explicit to the application that it should expect the result in "background".

You can find more information and references here:

Asynchronous Programming with Async and Await

Browser other questions tagged

You are not signed in. Login or sign up in order to post.