Пример #1
0
        static void Main(string[] args)
        {
            #region 属性get方法会重新执行
            CCar car = new CCar()
            {
                a = 1
            };
            car.b = 2;
            car.a = 5;
            #endregion

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            #region
            CCar car = new CCar()
            {
                a = 1
            };
            car.b = 2;
            Console.WriteLine(CCar.x); // 5
            car.a = 5;
            #endregion

            Console.WriteLine(car.c); //当用到时 才会触发get属性  10
            Console.ReadKey();
        }