StyleCopAnalyzers/SA1313 in a positional record: should be disabled?

Viewed 760

With C# 9, you can do the following:

public record Person(string FirstName, string LastName);

to define the record Person. This is equivalent to:

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);
}

according to this page.

So, the elements FirstName and LastName act both as a property and an argument for the constructor. As properties, these elements should be capitalized, but if I do it, SA1313 complains: Parameter '__' must begin with lower-case letter..

Is it a problem with StyleCop or am I doing something wrong?

1 Answers
Related