コード例 #1
0
    public static void Main(string[] args)
    {
      Student student = new Student();

      // Set the name by accessing it directly.
      Console.WriteLine("The first time:");
      student.name = "Madeleine";
      Student.OutputName(student); // Method now belongs to Student.

      // Change the name using a method.
      Console.WriteLine("After being modified:");
      Student.SetName(student, "Willa");
      Student.OutputName(student);

      // Wait for user to acknowledge.
      Console.WriteLine("Press Enter to terminate...");
      Console.Read();
    }