Does the keyword "async" really make the method asynchronous?

4

I was watching a video (at 31:11 minutes) and it says that async does not actually do this asynchronous, is more a "tip". Since I was in English and I am not fully advanced, the understanding was half empty.

To be able to enter the asynchronous world, I did some tests, but with little knowledge and using debug it will not act asynchronously I believe.

If the answer is "do not do asynchronous," then if it is a tip, what would be the "reason" for this "tip."

    
asked by anonymous 27.11.2016 / 23:55

1 answer

2

In fact declaring a method as async does not guarantee anything. It is telling the compiler only that it can be called asynchronously, ie it can be used a await . This is the command that will do asynchronicity. You can call this method synchronously if you wish, although it probably has not been written to use it like this.

When we mark the method as async we allow it to contain a await within it.

Currently a method marked with async should return void , Task or Task<T> , but this should change.

You, the programmer should ensure that the code runs asynchronously, this pair of commands only does the dirty work.

Documentation on the subject . You can translate the pages, but knowing how to read in English even helps.

    
28.11.2016 / 00:18