jjzjj

ProductEventArgs

全部标签

C# 任务工厂超时

我必须在一个线程中执行一个长进程操作,然后将结果返回给一个函数来继续。这是我的代码:Task.Factory.StartNew(()=>{try{//longoperationwhichreturnnewProductEventArgswithalistofproduct}catch(Exceptione){returnnewProductEventArgs(){E=e};}}).ContinueWith((x)=>handleResult(x.Result),TaskScheduler.FromCurrentSynchronizationContext());问题实际上是我没有超时。