New Paste

 

Recent Pastes

Administrate




Devhat Pastebin

PasteID: 94
Pasted by Kentaree, 2012-02-19 22:36:35 GMT
Expires Never
Paste size 438 b
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1.     public class Singleton<T>
  2.     {
  3.         private static T instance;
  4.  
  5.         public static T Instance
  6.         {
  7.             get
  8.             {
  9.                 if (instance == null) {
  10.                     instance = (T)typeof(T).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, System.Type.EmptyTypes, null).Invoke(null);
  11.                 }
  12.                 return instance;
  13.             }
  14.         }
  15.     }
  16.  
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!