dotnet/roslyn
Add analyzer that catches properties that can be made readonly
Aperta
#53.227 aperta il 2 apr 2020
Area-IDEIDE-CodeStylehelp wanted
Metriche repository
- Star
- (20.414 stelle)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
Version Used:
Steps to Reproduce:
It would be nice to have an analyzer that catches that the following property can be made readonly. Hit this on a PR just recently.
public class Foo
{
public Foo(string property)
{
Property = property;
}
private string Property
{
get;
set; // <!-- Can remove
}
public void Method()
{
Console.WriteLine(Property);
}
}