Posted By

falconzy on 12/22/10


Tagged


Versions (?)

Singleton Pattern


 / Published in: C#
 

  1. # region Constructors
  2. private static volatile LogWorker current;
  3. private static object syncRoot = new Object();
  4.  
  5. private LogWorker()
  6. {
  7. }
  8.  
  9. public static LogWorker Current
  10. {
  11. get
  12. {
  13. if (current == null)
  14. {
  15. lock (syncRoot)
  16. {
  17. if (current == null)
  18. {
  19. current = new LogWorker();
  20. }
  21. }
  22. }
  23. return current;
  24. }
  25. }
  26. # endregion

Report this snippet  

You need to login to post a comment.