RE: Removing inherited properties from an object.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Jeff,
Jon's comment about changing the expected usability of an object is sound.
The basic technique here, however, would be to override the settor as well as
the getter in the property:


public override string Text
{
get
{
return base.Text;
}
set
{
// your cool code here...
}
}

-- Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"UJ" wrote:

I have a text object (see my previous post) that I've added some
functionality to. But I don't want the user to be able to change the text
without calling my routines. So I added the following code:


public override string Text
{
get
{
return base.Text;
}
}


but I can still do something like testobject.text = "Fred"; and it
works. How can I make that not valid?

TIA - Jeff.



.