示例#1
0
        public void DemoAppleUse()
        {
            Console.WriteLine("对于 自动实现的属性 的使用,有下面2种方式:");

            Apple apple1 = new Apple();
            apple1.Country = "中国";
            apple1.Color = "红";
            Console.WriteLine(apple1.ToString());



            Apple apple2 = new Apple { Country = "中国", Color = "青" };
            Console.WriteLine(apple2.ToString());

        }
示例#2
0
        public void DemoAppleUse()
        {
            Console.WriteLine("对于 自动实现的属性 的使用,有下面2种方式:");

            Apple apple1 = new Apple();

            apple1.Country = "中国";
            apple1.Color   = "红";
            Console.WriteLine(apple1.ToString());



            Apple apple2 = new Apple {
                Country = "中国", Color = "青"
            };

            Console.WriteLine(apple2.ToString());
        }