center1010
asked on
c# Task with arguments
like this it's working:
But i need to add arguments to Method1 like this:
How can i do it?
and how can i use the result from the second task?
public static OrderRS Method1()
{
OrderRS result = new OrderRS();
return result;
}
static void BS()
{
Task<OrderRS> TheFirst = Task.Factory.StartNew<OrderRS>(Method1);
Task TheSecond =TheFirst.ContinueWith(x=>
{
OrderRS t = x.Result;
int r = t.OrderId;
});
}
But i need to add arguments to Method1 like this:
public static OrderRS Method1(int r1,Trs r2)
{
OrderRS result = new OrderRS();
return result;
}
static void BS()
{
Task<OrderRS> TheFirst = Task.Factory.StartNew<OrderRS>(Method1(r1,Trs));
Task TheSecond =TheFirst.ContinueWith(x=>
{
OrderRS t = x.Result;
int r = t.OrderId;
});
}
How can i do it?
and how can i use the result from the second task?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
public static OrderRS Method1(int r1,Trs r2)