Reporter | Drew Noakes (drewnoakes) |
---|---|
Created | May 23, 2008 5:23:50 PM |
Updated | Apr 11, 2018 6:44:11 PM |
Subsystem | Code Analysis |
Assignee | Ivan Serduk (IvanSerduk) |
Priority | Normal |
State | Open |
Type | Feature |
Fix version | Backlog |
Affected versions | No Affected versions |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
In the following code, the field is not required. It would suffice to make both usages local in scope. I can't think of a scenario in which applying this change would break the code's behaviour.
public sealed class TestClass
{
private string _field;
public void A()
{
_field = "A";
_field.ToString();
}
public void B()
{
_field = "B";
_field.ToString();
}
}
public sealed class TestClass
{
private string _field;
public void A()
{
_field = "A";
_field.ToString();
}
public void B()
{
_field = "B";
_field.ToString();
}
}