I have defined a Variable as ThreadStatic:
public static class MyApplicationContext {
[ThreadStatic]
public static bool Monitoring;
}
Now, I should set the variable Monitoring from the MainThread (which have started the new Thread):
this.syncThread = new Thread(this.InternalWork);
this.syncThread.SetApartmentState(ApartmentState.STA);
this.syncThread.Start();
// now, I should access MyApplicationContext.Monitoring of syncThread.
Is there a way to do this?