Task.Run and expected delegate

前端 未结 2 710
甜味超标
甜味超标 2021-01-16 08:06

I am not sure how to make sense out of the following observed results.

var f = new Func(uc.ViewModel.SlowProcess);

1) (VALID         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-16 08:56

    Your delegate that you are passing into Task.Run does not match and any of the expected signatures. It takes in a CancellationToken and returns a string which does not match any of the allowed signatures.. Getting rid of the cancellation token allows it to match on of these:

    Run(Func)  
    Run(Func, CancellationToken)
    

提交回复
热议问题