更新时间:2023-12-02 21:31:04
自C#6.0起,具有自动属性初始化程序的功能。语法为:
The ability to have auto property initializers is included since C# 6.0. The syntax is:
public int X { get; set; } = x; // C# 6 or higher
C#转换现有的类以正确使用属性