title: Memory will not release in C# singleton mode
body: <p>I have a puzzle about singleton mode freeing object memory in C# between in C++;
  Here C++ Code:</p>
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  class Rocket
  {
  private:
      Rocket() { speed = 100; }
      ~Rocket() {}
      static Rocket* ms_rocket;
  public:
      int speed;
      static Rocket*ShareRocket()
      {
          if (ms_rocket == NULL)
              ms_rocket = new Rocket();
          return ms_rocket;
      }
      static void Close()
      {
          if (ms_rocket != NULL)
              delete ms_rocket;
      }
  };
  Rocket *Rocket::ms_rocket = NULL;
  int main()
  {
      Rocket* p =  Rocket::ShareRocket();
      p-&gt;speed = 100;
      cout &lt;&lt; p-&gt;speed &lt;&lt; endl;
      Rocket::Close();
      cout &lt;&lt; p-&gt;speed &lt;&lt; endl;
      getchar();
  }
  </code></pre>
  <p>When I use Rocket::Close(), the memory space which ms_rocket pointed to will be freed, ms_rocket become a wild pointer, and the second &quot;cout&lt;age&lt;&lt;endl&quot; show is not 100, but when  I use C# , I also use Dispose(), but still show 100. here the C# code:</p>
  <pre><code>    class A : IDisposable
      {
          public int age;
          public A() {  }
          public void Run()
          {
              Console.WriteLine(&quot;Run&quot;);
          }
          #region IDisposable Support
          private bool disposedValue = false; 
  
          protected virtual void Dispose(bool disposing)
          {
              if (!disposedValue)
              {
                  if (disposing)
                  {
                      Console.WriteLine(&quot;A is release&quot;);
                  }
                  disposedValue = true;
  
              }
          }
          public void Dispose()
          {
              Dispose(true);
          }
          #endregion
      }
  
      class B
      {
          static A a;
          private B() { }
          public static A Intance
          {
              get
              {
                  if (a == null)
                      a = new A();
                  return a;
              }
          }
  
      }
      class Class1
      {
  
          public static void Main(string[] args)
          {
              A a = B.Intance;
              a.age =100;
              Console.WriteLine(a.age);
              a.Dispose();
              A a1 = B.Intance;
              Console.WriteLine(a1.age);
              Console.Read();
          }
      }
  </code></pre>
  <p>In C#, I think when I use Dispose(), the memory('a' object in B singleton) will be released, but in the second access, the age value should not be 100, and the static variable 'a' will become like a wild pointer.
  Who can tell me why?</p>