static void Main(string[] args) { #region 属性get方法会重新执行 CCar car = new CCar() { a = 1 }; car.b = 2; car.a = 5; #endregion Console.ReadKey(); }
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(); }