示例#1
0
        static void Main(string[] args)
        {
            CounterClass counter1 = new CounterClass();

            counter1.Add(5);

            Console.WriteLine(counter1.Get());

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Counter.CounterClass[] myCounter = new CounterClass[3];
            myCounter[0] = new CounterClass("Counter 1");
            myCounter[1] = new CounterClass("Counter 2");
            myCounter[2] = myCounter[0];

            for (int i = 0; i < 4; i++)
            {
                myCounter[0].Increment();
            }

            for (int i = 0; i < 9; i++)
            {
                myCounter[1].Increment();
            }

            PrintCounters(myCounter);
            myCounter[2].Reset();
            PrintCounters(myCounter);
        }