dotnet/roslyn
Add analyzer that catches properties that can be made readonly
Aberta
#53.227 aberto em 2 de abr. de 2020
Area-IDEIDE-CodeStylehelp wanted
Métricas do repositório
- Stars
- (20.414 estrelas)
- Métricas de merge de PR
- (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)
Description
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);
}
}