The MSDN library lists the await
keyword as an operator. That seems strange to me - I'd have thought it was a modifier, like the async
keyword.
Why is this an operator?
async
is a modifier for a declaration. Similar to public
.
await
is an operation that consumes an asynchronous operator and does something with it. Similar to return
.
await
isn't modifying what is placed after it, but instead specifying how that operation is handled. In contrast async
doesn't actually modify anything, it merely marks that a particular method is in the style of async
(it is the eventual await
's that perform all of the changes to the methods structure from a syntatic standpoint).
A modifier applies to a declaration. The private, static, out, ref, params, override keywords are examples of that. And async.
An operator applies to an expression and transforms the expression result. What you write on the right of await is called the "await expression". It is thus a unitary operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With