Task chaining without TaskCompletionSource?

前端 未结 3 843
故里飘歌
故里飘歌 2021-01-05 12:53

I\'m converting some async/await code to chained tasks, so I can use it in the released framework. The await code looks like this

public async Task

        
3条回答
  •  我在风中等你
    2021-01-05 13:23

    Yes, the framework comes with a handy Unwrap() extension method for exactly what you want.

    Invoke("GET").ContinueWith( t => t.Result.Memorize() ).Unwrap();
    

    If you're doing cancellation then you'll need to pass cancel tokens into the appropriate places, obviously.

提交回复
热议问题