title: singleton pattern in C# Question
body: <p>I was researching on the singleton pattern for C# I found this example from the msdn website.</p>
  
  <pre><code>public sealed class Singleton
  {
     private static readonly Singleton instance = new Singleton();
  
     private Singleton(){}
  
     public static Singleton Instance
     {
        get 
        {
           return instance; 
        }
     }
  }
  </code></pre>
  
  <blockquote>
    <p>Because the Singleton instance is
    referenced by a private static member
    variable, the instantiation does not
    occur until the class is first
    referenced by a call to the Instance
    property. This solution therefore
    implements a form of the lazy
    instantiation property, as in the
    Design Patterns form of Singleton.</p>
  </blockquote>
  
  <p>I am not pretty sure when will the memory will get allocated to </p>
  
  <pre><code>private static readonly Singleton instance 
  </code></pre>
  
  <p>1)Will it happen when the Instance property is called or even before it?</p>
  
  <p>2) I need to force the class to create a new memory sometimes to purge its content. Is it safe to do so using <code>set</code> ?</p>
  
  <pre><code>set
  {
  instance = null;
  }
  </code></pre>