コード例 #1
0
        public bool AreInstancesTheSame()
        {
            CakeFactorySingleton cakeFactory1 = CakeFactorySingleton.GetInstance();
            CakeFactorySingleton cakeFactory2 = CakeFactorySingleton.GetInstance();

            return(cakeFactory1 == cakeFactory2);
        }
コード例 #2
0
 public static CakeFactorySingleton GetInstance()
 {
     return(_instance ?? (_instance = new CakeFactorySingleton()));
 }