Your options:
- Encapsulate the parameters in a new class and place the method for use by the delegate in this class.
- Use anonymous functions (anonymous methods or lambda expressions) to do the same automatically with captured variables.
The latter, of course, is easier. You have not shown what you are doing with the stream, but you can do something like:
string storeID = "...";
string queryObject = "...";
Thread t = new Thread(() => StartDNIThread(storeID, queryObject));
t.Start();
, , , , , . , , :
string storeID = "...";
string queryObject = "...";
string storeIDCopy = storeID;
string queryObjectCopy = queryObject;
Thread t = new Thread(() => StartDNIThread(storeIDCopy, queryObjectCopy));
t.Start();
, - , . :
foreach (string storeID in stores)
{
string storeIDCopy = storeID;
Thread t = new Thread(() => StartDNIThread(storeIDCopy, queryObject));
t.Start();
}
, .