位置记录 : should be disabled? 中的 StyleCopAnalyzers/SA1313

标签 stylecop c#-9.0

使用 C# 9,您可以执行以下操作:

public record Person(string FirstName, string LastName);
定义记录 Person .这相当于:
public record Person 
{ 
    public string FirstName { get; init; } 
    public string LastName { get; init; }
    public Person(string firstName, string lastName) 
      => (FirstName, LastName) = (firstName, lastName);
    public void Deconstruct(out string firstName, out string lastName) 
      => (firstName, lastName) = (FirstName, LastName);
}
根据 this page .
因此,元素 FirstNameLastName作为构造函数的属性和参数。作为属性,这些元素应该大写,但如果我这样做,SA1313 会提示:Parameter '__' must begin with lower-case letter. .
这是 StyleCop 的问题还是我做错了什么?

最佳答案

这是 StyleCop 和 it's been fixed for the 1.2.0-beta.261 release 中的一个问题.

关于位置记录 : should be disabled? 中的 StyleCopAnalyzers/SA1313,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64884856/

相关文章:

code-analysis - 有没有人为FxCop/StyleCop创建任何很酷的规则?

c# - 常量首字母缩略词的命名约定

delphi - 用于德尔福的 FxCop/StyleCop?

c# - Visual Studio 未显示 WSL2 启动配置文件

c# - C#9 不支持 JsonPropertyNameAttribute 记录?

c# - 如何向 C# 9 记录添加注释

C# + StyleCop + MSBuild + 全局区域性设置无法获取

c# - 目标确实存在时出现 StyleCop CA0055 问题

.net - 是否可以在 .NET Framework 4.x 中使用带有 C# 9 Records 的库

c# - 如何告诉编译器必须初始化属性