디자인 패턴 - 싱글톤 (Singleton)
Singleton 애플리케이션을 실행한 후 인스턴스를 하나만 생성하여 어디서든 그 인스턴스에 접근할 수 있도록 하는 디자인 패턴 일반적인 싱글톤 패턴의 클래스는 다음 3가지의 요소를 가집니다 private 생성자 private static 인스턴스 객체 public static 객체 반환 함수 public class Singleton { private Singleton() { } private static Singleton _instance; public static Singleton Instance { get { if (_instance == null) { _instance = new Singleton(); } return _instance; } } }하지만 이럴경우 Single thread 환경에서는..
2021.04.01