In the days of v1.1, the need to start a new thread with parameters almost arises on every instance - there was no way, at least none that I know of. However, v2.0 of the .Net Framework allows you to start a new thread and also pass a parameter to it. It doesn't get any better. I have been messing around with some threading recently and it came in handy. Sample code:
private void BeginThreading()
{
int id = 1;
// Method #1
new System.Threading.Thread(
new System.Threading.ParameterizedThreadStart(DoStuff)).Start(id);
// Method #2
System.Threading.Thread
newDoStuff = new System.Threading.Thread(
new System.Threading.ParameterizedThreadStart(DoStuff));
newDoStuff.Start(id);
}
private void DoStuff(object id)
{
int newId = (int) id;
// do stuff here
}