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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -