Код: Выделить всё
public record Point(int X, int Y);
public static void Main()
{
Point pt = new Point(1, 1);
var pt2 = pt with { Y = 10 };
Console.WriteLine($"The two points are {pt} and {pt2}");
}
Код: Выделить всё
/home/user/a/Program.cs(2,1): error CS8803: Top-level statements must precede namespace and type declarations.
/home/user/a/Program.cs(2,1): error CS0106: The modifier 'public' is not valid for this item
The build failed. Fix the build errors and run again.
Подробнее здесь: https://stackoverflow.com/questions/798 ... n-net-10-0