Okay, so I am using linq and thus I have a few "var" types object created dynamically, as in
var Order = CustomerDataContext.Order.Where(e => e.OrderPending)
and many others like this, so the problem is how can I maintain this "var" across method calls, I am using
ThreadPool.QueueUserForWorkItem(ProcessOrder, var)
but this method accepts object and I cannot cast the back in parameter back into Order type. Also, since its dynamic it cannot even be declared as static, so that I may maintain state, so what should I do? How should I maintain this var, or if I cannot, then what is the other way to do what I am doing?
The point is, after I filter, and pass this filtered record to some other method, how do I get its same recordset or say same filtered list back, also if the method expects an argument of type object, as you cannot convert it into Order type because that var was just local variable to the caller function.
We can still create a new Order, but that would destroy the whole purpose of filtering some records and then passing those records to another method to be processed? If we create a new Order in other method say,
ProcessOrder
in this case, it will be a new Order type and not the one filtered on some condition and passed as parameter to this method. I hope I made my point clear.
Can any one help me with this?