Concealing acquired participants

I'm seeking some means to properly hide acquired participants. I have a collection of courses which acquire from usual base courses. Several of the extra current offspring courses acquire dependency properties which have actually come to be vestigial and also can be a little complex when making use of IntelliSense or making use of the courses in an aesthetic developer.

These courses are all controls that are contacted be assembled for either WPF or Silverlight 2.0. I find out about ICustomTypeDescriptor and also ICustomPropertyProvider, yet I'm rather particular those can not be made use of in Silverlight.

It's not as a lot an useful concern as an use concern. What should I do?

Update

Several of the buildings that I would actually such as to hide originated from forefathers that are not my very own and also as a result of a details device I'm making for, I can not do participant hiding with the new driver. (I recognize, it's ludicrous)

0
2019-05-06 02:03:26
Source Share
Answers: 4

I assume you're best the very least hackish means is to take into consideration make-up in contrast to inheritance.

Or, you can create a user interface that has the participants you desire, have your acquired class implement that user interface, and also program versus the user interface.

0
2019-05-08 10:46:40
Source

One possible point you can do is have the object as opposed to expand from the various other class. This will certainly offer you one of the most adaptability in regards to revealing what you intend to reveal, yet if you definitely require the challenge be of that type it is not the excellent remedy (nonetheless you can reveal the object from a getter).

Hence :

public class MyClass : BaseClass
{
    // Your stuff here
}

Comes to be :

public class MyClass
{
    private BaseClass baseClass;

    public void ExposeThisMethod()
    {
        baseClass.ExposeThisMethod();
    }
}

Or :

public class MyClass
{
    private BaseClass baseClass;

    public BaseClass BaseClass
    {
        get
        {
            return baseClass;
        }
    }
}
0
2019-05-08 10:44:14
Source

Override them like Michael Suggests above and also to stop individuals from making use of the overridden (sp?) approaches, note them as out-of-date :

[Obsolete("These are not supported in this class.", true)]
public override  void dontcallmeanymore()
{
}

If the 2nd parm is readied to real, a compiler mistake will certainly be created if any person attempts to call that method and also the string in the first parm is the message. If parm2 is incorrect just a compiler caution will certainly be created.

0
2019-05-08 10:30:56
Source

While you can not protect against use of those acquired participants to my expertise, you need to have the ability to hide them from IntelliSense making use of the EditorBrowsableAttribute :

Using System.ComponentModel;

[EditorBrowsable(EditorBrowsableState.Never)]
private string MyHiddenString = "Muahahahahahahahaha";

Edit : Just saw this in the documents remarks, that makes it kinda pointless for this objective :

There is a noticeable note that states that this feature "does not subdue participants from a class in the very same setting up". That holds true yet not finish. In fact, the feature does not subdue participants from a class in the very same remedy.

0
2019-05-08 10:12:06
Source