ReSharper 2024.1 Help

Code Inspection: Parameter hides member

Category

Potential Code Quality Issues

ID

ParameterHidesMember

EditorConfig

resharper_parameter_hides_member_highlighting

Default severity

Warning

Language

C#, VB.NET

Requires SWA

No

There is not much wrong with the code example below, at least in its 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: 15 April 2024