在 C# 8 中将参数传递给类声明

问题描述 投票:0回答:1

从 C# 8 开始,我们可以做类似的事情:

public class MyClass(int a)
{
    // note, this is NOT the constructor, but the class declaration
}

这是如何运作的?

对于C#7,它被标记为实验性功能;但我找不到有关它的文档。 C# 8 仍被视为实验性的吗?

我看到这个:

c# rider
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.