Task.Yield - real usages?

前端 未结 6 2054
-上瘾入骨i
-上瘾入骨i 2020-12-01 05:29

I\'ve been reading about Task.Yield , And as a Javascript developer I can tell that\'s it\'s job is exactly the same as setTime

6条回答
  •  北海茫月
    2020-12-01 05:48

    I've only found Task.Yield useful in two scenarios:

    1. Unit tests, to ensure the code under test works appropriately in the presence of asynchrony.
    2. To work around an obscure ASP.NET issue where identity code cannot complete synchronously.

提交回复
热议问题