Guest User

Untitled

a guest
Jul 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public sealed class Singleton
  2. {
  3. private static readonly Singleton instance;
  4.  
  5. // Explicit static constructor to tell C# compiler
  6. // not to mark type as beforefieldinit
  7. static Singleton()
  8. {
  9. instance = new Singleton();
  10. }
  11.  
  12. private Singleton()
  13. {
  14. }
  15.  
  16. /// <summary>
  17. /// The public Instance property to use
  18. /// </summary>
  19. public static Singleton Instance
  20. {
  21. get { return instance; }
  22. }
  23. }
Add Comment
Please, Sign In to add comment