类的书写

using System;

public class Car
{
    private string make;
    public string Make
    {
        get
        {
            return make;
        }
        set
        {
            make = value;
        }
    }
}

class Example1
{
    public static void Main()
    {
        Car myCar = new Car();
        System.Console.WriteLine("Setting the car object's Make property to porsche");
        myCar.Make = "Porsche";
        System.Console.WriteLine("myCar.Make = " + myCar.Make);
        int i = System.Console.Read();
    }
}
原文地址:https://www.cnblogs.com/djcsch2001/p/2034639.html