作为类的property
类的构造器在使用 => 表达式,会在每次访问该值时都调用后面的表达式。
public class Student{
private static int age;
public int Age => age;
}
static void Main(){
Student stu = new Student()
Console.WriteLine(stu.age) // 0
Student.age = 18;
Console.WriteLine(stu.age) // 18
}