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
Post a Comment