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?
This is a problem in StyleCop and it's been fixed for the 1.2.0-beta.261 release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With