c# - Task.Factory.StartNew with parameters and return values -


trying call method requires parameters in order result , pass result proceed. i'm new task area , can't seem figure out correct syntax. appreciated.

task.factory.startnew(() =>      checkconflict(startdate, enddate, actid, repeatrule,whichtime))     .continuewith(         getconflictdelegate(result),         taskscheduler.fromcurrentsynchronizationcontext); 

assuming want continue result of checkconflict(), continuewith takes task<t> argument. task<t> has property result, result method invocation.

see code snippet below, example.

new taskfactory() .startnew(() =>     {         return 1;     }) .continuewith(x =>     {         //prints out system.threading.tasks.task`1[system.int32]         console.writeline(x);         //prints out 1         console.writeline(x.result);     }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -