You have captured the loop variable in a closure. That doesn't work as you'd expect:
Closing over the loop variable considered harmful : Eric Lippert’s Blog[
^]
In .NET 4.5, this was fixed for
foreach
loops; however,
for
loops retain the old behaviour.
To fix it, you need to create a copy of the loop variable, and use that copy in your closure:
for (int i = 0; i < 5; i++)
{
int iCopy = i;
Class1 obj = new Class1();
new Thread(() => obj.Show(iCopy)).Start();
}