Right now I have
class MyParamClass
{
all the parameters I need to pass to the task
}
MyParamClass myParamObj = new MyParamClass();
myParamObj.FirstParam = xyz;
myParamObj.SecondParam = abc;
mytask = new Task<bool>(myMethod, myParamObj,_cancelToken);
mytask.Start()
bool myMethod(object passedMyParamObj)
{
MyParamClass myParamObj = passedMyParamObj as MyParamClass;
//phew! finally access to passed parameters
}
Is there anyway I can do this without having the need to create class MyParamClass ? How can I pass multiple params to a task without this jugglery ? Is this the standard practice ? thank you