I have a custom control, call it ctrlFoo
, that derives from System.Web.UI.Control
.
When this custom control is instantiated I can see all System开发者_如何学Python.Web.UI.Control
's public properties which is abit annoying in intellisense, as there are so many of them.
Inside ctrlFoo
i've tried
private new string SkinID { get; set; }
But I can still see this property in the initialised instance of ctrlFoo
.
Can anyone offer any other suggestions?
You're missing the point of inheriting from Control
. If ctrlFoo
really is a Control
, then you shouldn't be hiding properties that Control
s have. Control
has a SkinID
, so ctrlFoo
should have a SkinID
too.
If you don't like what appears in Intellisense, then change your Intellisense settings (I've never heard anyone complain about IntelliSense before).
You can still see it because you see the System.Web.UI.Control.SkinID
, which is public.
You may hide that property by making access modifiers private
for get
and set
accessors, but the base property must be virtual or abstract to be overriden.
You cannot hide inherited properties. This would violate the Liskov substitution principle.
精彩评论