根据《坚果壳中的C#12》一书:
在C#11之前, struct 中的每个字段都必须显式分配 在构造函数(或字段初始化器)中.这一限制现已 很放松.
然而这:
using System;
Point point = new Point();
Console.WriteLine(point.X);
struct Point
{
public int X;
public int Y;
}
当使用.NET 5(如果我理解正确的话,它是C#9)编译时,会编译和运行(返回0)?资料来源:https://dotnet.microsoft.com/en-us/download/dotnet/5.0).