Given the following code:
public static class Super { public static class Inner { public static string SomeValue { get; set; } } public static string SomeValue { get; set; } }
Resharper tells me that Super.Inner.SomeValue
hides a property from the outer class.
How is there hiding going on? You have two distinct references (Super.SomeValue
and Super.Inner.SomeValue
). And (as far as I know) you cannot use one reference to mean the other variable.
I have found that Resharper is wrong sometimes. But not usually. So I would like to know what it is thinking here.
Any Ideas?
I'm guessing because it means using SomeValue
in the inner class means you get the value assigned to the inner class rather than the outer class.
Consider this:
public static class Super { public static class Sub { public static string OtherValue {get{return SomeValue;}} // Remove this line and OtherValue will return Outer public static string SomeValue { get{return "Inner"; }} } public static string SomeValue { get{return "Outer"; }} }
Currently Super.Sub.OtherValue
will return Inner
but removing the line I've commented will cause it to return Outer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With