let’s say i have this
public class MyClass
{
public string myMessage { get; set; }
void MyMethod()
{
string myMessage;
}
}
shouldn’t i get an alert about myMessage in MyMethod hiding(?) the myMessage property on the class? i’m not getting anything to this effect when i build. how do i activate this check?
I know of no warning for this condition. Within
MyMethod(), you can usethis.myMessageto disambiguate between the local and the class property.Just FYI, properties are usually TitleCased while locals are camelCased. Using that convention can prevent naming clashes like the one you list.