static void Main(string[] args)
{
int i = 10;
Program th = new Program();
Thread t2 = new Thread(() => thread2(out i));
t2.Start();
Thread t1 = new Thread(() => thread1(i));
t1.Start();
Thread.Sleep(5000);
Console.WriteLine("Main thread exits." + i);
Console.ReadLine();
}
static void thread1(int i)
{
Console.WriteLine(i);
i = 100;
}
static void thread2(out int i) // what should be the value of i???
{
Thread.Sleep(5000);
i = 21;
Console.WriteLine(i);
}
what should be the value received in called method while we are passing out parameters?? "whether it is zero or the value we are passing"