Thursday, September 18, 2014

How to write Singleton pattern in C#?

http://msdn.microsoft.com/en-us/library/ff650316.aspx
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;
      }
   }
}

No more JS frameworks

http://bitworking.org/news/2014/05/zero_framework_manifesto