Advertisement
Guest User

Untitled

a guest
Mar 18th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. public sealed class Singleton
  2. {
  3.     static Singleton instance=null;
  4.     static readonly object padlock = new object();
  5.  
  6.     Singleton()
  7.     {
  8.     }
  9.  
  10.     public static Singleton Instance
  11.     {
  12.         get
  13.         {
  14.             lock (padlock)
  15.             {
  16.                 if (instance==null)
  17.                 {
  18.                     instance = new Singleton();
  19.                 }
  20.                 return instance;
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement