Can I await something if there's no GetAwaiter method?

前端 未结 2 1749
忘了有多久
忘了有多久 2020-12-09 06:15

I saw some articles about designing a custom awaitable type:

http://books.google.com.br/books?id=1On1glEbTfIC&pg=PA83&lpg=PA83&dq=create+a+custom+awaitab

2条回答
  •  春和景丽
    2020-12-09 06:55

    You can supply your own implementation of GetAwaiter via an extension method if one does not exist.

    http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx

提交回复
热议问题