dotnet/roslyn
Add analyzer that catches properties that can be made readonly
Ouverte
#53 227 ouverte le 2 avr. 2020
Area-IDEIDE-CodeStylehelp wanted
Métriques du dépôt
- Stars
- (20 414 étoiles)
- Métriques de merge PR
- (Merge moyen 6j 17h) (256 PRs mergées en 30 j)
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);
}
}