且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#转换现有的类以正确使用属性

更新时间: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