ReSharper 2017.2 Help

Code Inspection: Parameter hides member

There is not much wrong with the code example below, at least in it current state where you can observe everything at once. However, as the class would grow, someone who reads the code could mistakenly think that DoSomething() uses the property bar and not the parameter. Furthermore, if someone removes the parameter bar later, they may not notice that the remaining usages of bar will be returning the value of the property.

Therefore, ReSharper issues a warning to draw your attention to potential problems with this code and provides quick-fixes that help you quickly rename either the parameter or the property.

class Foo { public string bar { get; set; } public void DoSomething(string bar) { Console.WriteLine(bar); } }
Last modified: 12 October 2017

See Also