Regarding how Async and Await works c#

前端 未结 7 1187
深忆病人
深忆病人 2021-01-13 12:40

i saw some post regarding Async and Await usage in this site. few people are saying that Async and Await complete its job on separate background thread means spawn a new bac

7条回答
  •  迷失自我
    2021-01-13 13:08

    You are asking the wrong question

    In effect you are asking, how does a parcel get to my doorstep? By ship or by plane?

    The point is that your door step doesn't care wither the parcel was delivered by sea or air.

    However the main reason for Microsoft to develop the Task/async/await framework was to take advantage of Event based programming as opposed to Thread based programming.

    In general Event based programming is MUCH more efficient and faster than Thread based programming. Which is why most of the .net API uses it. Up until now, however most people avoided Event based programming because it is extremely difficult to understand (again, async/wait was put into place to make this simple).

提交回复
热议问题