I\'ve been using c# since version 1, and have never seen a worthwhile use of member hiding. Do you know of any?
We had a class that inherited from the WebControl class. When we upgraded from 3.5 to 4.0, the way that some of our attributes (mainly around onclick and javascript) changed quite radically.
We could not change how the AttributeCollection
class was handled by the WebControl
, so what we did was implement the same methods and properties of the AttributeCollection
in our custom collection and hid the AttributeCollection
property with our own.
None of the accessing code changed, and we were able to correctly implement how to handle the attributes in our classes. Now no one needs to know what we did to fix the problem. All they need to know is that they call Attributes.Add
like normal, and we fix things under the hood.