예제 #1
0
        static void Main(string[] args)
        {
            Console.Write(Type1.staticInt);

            //Type1 Type1 = new Type1();
            Console.Write(Type1.staticInt);

            Type2 type2 = new Type2();

            Console.Write(type2.regularInt);

            Type3 type3 = new Type3();

            Console.Write(type3.type1);

            Console.Write(type3.type2.regularInt);

            Console.Write(Type4.type1);
            Console.Write(Type4.type2.regularInt);

            Console.Write(Type5.staticInt);
            Console.Write(Type5.type5.regularInt);

            Console.Write(Type6.GetInstance().regularInt);

            Console.Write(Type7.GetInstance().regularInt);
        }
예제 #2
0
 public static Type7 GetInstance()
 {
     if (_instance == null)
     {
         _instance = new Type7();
     }
     return(_instance);
 }