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 var 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?
Quote from here:
You don’t maintain
vartype. in your sample, theOrderis probably of typeIQueryable. var is just a shortcut so you don’t have to specify the type of variable and let the compiler do it. So you could’ve just written: