Advertisement
minafaw3

Singleton

Jul 9th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public sealed class Singleton
  2. {
  3. to achieve singleton
  4. (private static , private (correct) , public , protected )
  5. ..... Singleton()
  6. {
  7. }
  8. private static Singleton instance = null;
  9. public static Singleton Instance
  10. {
  11. get
  12. {
  13. if (instance == null)
  14. {
  15. instance = new Singleton();
  16. }
  17. return instance;
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement