here is sample of code for
private void MethodStarter()
{
Task myFirstTask = Task.Factory.StartNew(Method1);
Task mySecondTask = Task.Factory.StartNew(Method1);
}
private void Method1()
{
// your code
}
private void Method2()
{
// your code
}
i am looking for code snippet for Parallel Tasks by which i can do the callback and pass argument to function also. can anyone help.
If I understood your question right this might be the anwser:
If you want to start all the threads at the same time you can use the example given by h1ghfive.
UPDATE:
An example with callback that should work but I haven’t tested it.
You can alos look at Continuation if you don’t want to pass in callback functions.