My question is that the object text initialized with "t1" and then a t1 thread started and then text becomes "t2" and later one more thread t2 started.
I was expecting:
t1
t2
Real output:
t2
t2
Why ?
class Program
{
static void Main()
{
string text = "t1";
Thread t1 = new Thread(() => Console.WriteLine(text));
t1.Start();
text = "t2";
Thread t2 = new Thread(() => Console.WriteLine(text));
t2.Start();
}
}