When we use async and await keyword in our code, compile time a structure is generated which is said to be state machine. Why generated structure is termed as state machine, why not Strategy or Proxy? Answer to this question lies in definition of state machine. As per the definition of state machine available on internet "In general, a state machine is any device that stores the status of something at a given time and can operate on input to change the status and/or cause an action or output to take place for any given change." Does generated structure works like this? Answer is Yes. Async/Await keyword supports suspension and resumption model and this is all achieved with the help of state machine. In order to build state machine, compiler does a lot of thing in compiled code. We will explore these things in coming sections.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

C#,.NET,Architect,Intermediate,VS2012,.Net,Articles,Computer Tutorials