Is prevTask.Wait() recommended to be used with ContinueWith (from the Tasks library)?

前端 未结 7 1357
独厮守ぢ
独厮守ぢ 2020-12-07 15:40

So I was told recently that how I was using my .ContinueWith for Tasks was not the proper way to use them. I have yet to find evidence of this on the internet so I will ask

7条回答
  •  既然无缘
    2020-12-07 15:55

    From the MSDN on Task.Continuewith

    The returned Task will not be scheduled for execution until the current task has completed. If the criteria specified through the continuationOptions parameter are not met, the continuation task will be canceled instead of scheduled.

    I think that the way you expect it to work in the first example is the correct way.

提交回复
热议问题