title: Static Variable Instances and AppDomains, what is happening?
body: <p>I have</p>
  
  <pre><code>public static class A
  {
     public static string ConnString;
  }
  
  [Serializable]
  public class Test{
     // Accesing A's field;
     public string ConnString{get{return A.ConnString;}set{A.ConnString=value;}}
  }
  
  void Main()
  {
     A.ConnString = "InitialString"; // I set A.ConnString in the current domain
  
     var newDomain = AppDomain.CreateDomain("DomNew");
     Test TObj = newDomain.CreateInstanceAndUnwrap(typeof(Test).Assembly.FullName, typeof(Test).FullName) as Test ;
  
     TObj.ConnString = "NewDomainString"; // It is supposed to set A.ConnString in the newDomain aka a different instance of A.ConnString
  
     // Here it is supposed to print two different values
     Console.WriteLine(A.ConnString);  // "InitialString"
     Console.WriteLine(TObj.ConnString); // "NewDomainString"
  }
  </code></pre>
  
  <p>But NO! The two WriteLines, print out the same value "NewDomainString"!
  WHY???</p>
  
  <p>this code</p>
  
  <pre><code>TObj.ConnString = "NewDomainString"
  </code></pre>
  
  <p>is supposed to change the string in the newly created domain, but it seems they both refer to the same instance!</p>
  
  <p>Why, what is happening here?</p>