c# - How to create a new Task of type Task? -
i have:
async task dowork() { console.writeline("do async work in method"); } task task = new task(dowork); //line x task.start(); task.wait(); line x gives compilation error:
cs0407 'task form1.dowork()' has wrong return type
how instantiate new task dowork?
i able use following gives me different set of problems.
task task = dowork(); task.wait(); i want avoid second method. how instantiate new task of type async task @ line x?
since dowork() has return type of task, declaration needs instance of generic task<tresult> - i.e. task<task>
Comments
Post a Comment