async await best practices

后端 未结 3 1912
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 12:32

I\'ve grasped the concept of async await and have been using it sporadically, but do have a couple questions regarding best practices.

  1. is it ok to use await in

3条回答
  •  囚心锁ツ
    2021-02-06 13:14

    It is not ok to use a loop to keep fething data that may be present.. You can create an async call that upon completion will automaticlly invoke a callback method.. the "waiting" phase in that case will happen in the OS mechanisms which treat this waiting phase in optimum way to the OS being used.

    Take a look here for further study of the subject: http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx

提交回复
热议问题