here is my testing code:
class Program
{
static void Main(string[] args)
{
new Thread(delegate() { runThread(); }).Start();
Console.WriteLine(Global.test);
Console.ReadKey();
}
private static void runThread()
{
Console.WriteLine("this is run thread");
Global.test = "this is test from thread";
Console.WriteLine(Global.test);
}
}
public class Global
{
public static string testV { get; set; }
}
I want to be able to set "testV" value with a thread. it looks like Thread does set value, but when retrieving testV value from main method, it gives nothing. why is that?