I can't get my Task<> to execute!


new kind. have tried write task<> can awaited:

        task<bool> renderasync(string reportname)          {                return new task<bool>(() =>                  {                          return render(reportname);                  }              );            }

i execute method declared async following:

await renderasync(thereport);

the app compiles without errors , renderasync called , returns have expected. however, code within lambda never runs , render method , never called. missing?

michael


michael

you're not starting task:

task<bool> renderasync(string reportname) {     var task = new task<bool>(() => {         return render(reportname);     });     task.start();     return task; }

or simpler:

task<bool> renderasync(string reportname) {     return new task.run(() => {         return render(reportname);     }); }



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Deleting duplicate values from a collection?