Thread-sicheres C # Singleton-Muster

Ich habe einige Fragen zum Singleton-Muster, wie hier dokumentiert:http://msdn.microsoft.com/en-us/library/ff650316.aspx

Der folgende Code ist ein Auszug aus dem Artikel:

using System;

public sealed class Singleton
{
   private static volatile Singleton instance;
   private static object syncRoot = new object();

   private Singleton() {}

   public static Singleton Instance
   {
      get 
      {
         if (instance == null) 
         {
            lock (syncRoot) 
            {
               if (instance == null) 
                  instance = new Singleton();
            }
         }

         return instance;
      }
   }
}

Muss im obigen Beispiel die Instanz vor und nach der Sperre zweimal mit null verglichen werden? Ist das notwendig? Warum nicht zuerst die Sperre durchführen und den Vergleich durchführen?

Gibt es ein Problem bei der Vereinfachung von Folgendem?

   public static Singleton Instance
   {
      get 
      {
        lock (syncRoot) 
        {
           if (instance == null) 
              instance = new Singleton();
        }

         return instance;
      }
   }

Ist das Durchführen des Schlosses teuer?

Antworten auf die Frage(7)

Ihre Antwort auf die Frage