Making a field/operation invisible for intellitip

  • Thread starter Thread starter Lars-Erik Aabech
  • Start date Start date
L

Lars-Erik Aabech

Hi!

I've been looking around for an attribute that tells the intellitip thingy
to skip some field or operation. Is there any?
IE. a ListControl object has the DataSource property, but not all of the
inherited classes "supports" that public property, although you can use
them. Some of these properties are hidden from intellitip, but doesn't throw
a compiler error.

Ex.:
[Invisible(true)]
public bool NotImplementedBoolean
{
// need this to derive from an abstract class.
}

L-E
 
I do not think there is anything for that.
Although the name of the class System.ComponentModel.BrowsableAttribute
implies
it does this, it is for controlling which properties of a visual designer to
be shown in the properties window.
http://msdn.microsoft.com/library/d...omponentModelBrowsableAttributeClassTopic.asp

But anyway, since you have to override a public member of a base class,
that member will be visible anyway.

Just throw a NotImplementedException or a NotSupportedException.
 
I know about that one ;)
My current implementations of the methods throw a NotImplementedException..
But why show the method at all if that's what it does? :)

L-E

Dennis Myrén said:
I do not think there is anything for that.
Although the name of the class System.ComponentModel.BrowsableAttribute
implies
it does this, it is for controlling which properties of a visual designer
to be shown in the properties window.
http://msdn.microsoft.com/library/d...omponentModelBrowsableAttributeClassTopic.asp

But anyway, since you have to override a public member of a base class,
that member will be visible anyway.

Just throw a NotImplementedException or a NotSupportedException.


--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Lars-Erik Aabech said:
Hi!

I've been looking around for an attribute that tells the intellitip
thingy to skip some field or operation. Is there any?
IE. a ListControl object has the DataSource property, but not all of the
inherited classes "supports" that public property, although you can use
them. Some of these properties are hidden from intellitip, but doesn't
throw a compiler error.

Ex.:
[Invisible(true)]
public bool NotImplementedBoolean
{
// need this to derive from an abstract class.
}

L-E
 
Unfortunately, since these methods is overridden from the base class, even
if you did succeed hiding you overridden
version, the version of the base class will still be visible through
IntelliSense(reflection).

Do you have to derive that class?
If there are several abstract members that you do not actually implement,
does it really makes sense to
derive this class?
If the base class declares members as abstract, it really means it demands
an implementation of those members.

If you are in control of the base class, there could be lots of solutions,
though.
You could define two abstract base classes, one basic and one extended that
derives the basic one.
Or you could place the methods in an interface, and have those concrete
classes
that actually do implement the extended funtionality implement that
interface.

Well, it is just my opinion, although I probably did not provide much help.




--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Lars-Erik Aabech said:
I know about that one ;)
My current implementations of the methods throw a
NotImplementedException.. But why show the method at all if that's what it
does? :)

L-E

Dennis Myrén said:
I do not think there is anything for that.
Although the name of the class System.ComponentModel.BrowsableAttribute
implies
it does this, it is for controlling which properties of a visual designer
to be shown in the properties window.
http://msdn.microsoft.com/library/d...omponentModelBrowsableAttributeClassTopic.asp

But anyway, since you have to override a public member of a base class,
that member will be visible anyway.

Just throw a NotImplementedException or a NotSupportedException.


--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Lars-Erik Aabech said:
Hi!

I've been looking around for an attribute that tells the intellitip
thingy to skip some field or operation. Is there any?
IE. a ListControl object has the DataSource property, but not all of the
inherited classes "supports" that public property, although you can use
them. Some of these properties are hidden from intellitip, but doesn't
throw a compiler error.

Ex.:
[Invisible(true)]
public bool NotImplementedBoolean
{
// need this to derive from an abstract class.
}

L-E
 
Hi again :)

It's not much of a problem, and I appreciate your opinion. I control the
base class and will probably remove the method I din't implement. None of
the derived classes implement it, and there are no calls to it. It was only
put there for "future use"..
The question was mostly for fun. If MS can hide methods, I want to too ;)

L-E

Dennis Myrén said:
Unfortunately, since these methods is overridden from the base class, even
if you did succeed hiding you overridden
version, the version of the base class will still be visible through
IntelliSense(reflection).

Do you have to derive that class?
If there are several abstract members that you do not actually implement,
does it really makes sense to
derive this class?
If the base class declares members as abstract, it really means it demands
an implementation of those members.

If you are in control of the base class, there could be lots of solutions,
though.
You could define two abstract base classes, one basic and one extended
that derives the basic one.
Or you could place the methods in an interface, and have those concrete
classes
that actually do implement the extended funtionality implement that
interface.

Well, it is just my opinion, although I probably did not provide much
help.




--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Lars-Erik Aabech said:
I know about that one ;)
My current implementations of the methods throw a
NotImplementedException.. But why show the method at all if that's what
it does? :)

L-E

Dennis Myrén said:
I do not think there is anything for that.
Although the name of the class System.ComponentModel.BrowsableAttribute
implies
it does this, it is for controlling which properties of a visual
designer to be shown in the properties window.
http://msdn.microsoft.com/library/d...omponentModelBrowsableAttributeClassTopic.asp

But anyway, since you have to override a public member of a base class,
that member will be visible anyway.

Just throw a NotImplementedException or a NotSupportedException.


--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Hi!

I've been looking around for an attribute that tells the intellitip
thingy to skip some field or operation. Is there any?
IE. a ListControl object has the DataSource property, but not all of
the inherited classes "supports" that public property, although you can
use them. Some of these properties are hidden from intellitip, but
doesn't throw a compiler error.

Ex.:
[Invisible(true)]
public bool NotImplementedBoolean
{
// need this to derive from an abstract class.
}

L-E
 
Hi Lars-Erick,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to hide a method which is
derived from base class. If there is any misunderstanding, please feel free
to let me know.

I agree with Dennis's idea. As far as I know, this is impossible for us to
achieve this. Because according to the OOP specs, a derived class should
"support" all the base class methods. So if the based class is abstract, we
have to implement all it's methods.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi!

I think we're getting off track from the real question here. Say I have a
class with no relation to any objects what-so-ever, and that class has a
method that I didn't implement, but I'd like to keep it around for some
weird reason. In the meantime, I don't want anyone to "see" that the method
exists when using the class in Visual Studio, so I'd like to add an
attribute or something (except a comment block around it ;) ) so it doesn't
show up in the intellitip dropdown. Kind of like making it private, just
not.. Kind of silly too, but hey...

L-E
 
Hi Lars,

Now I understand that you need to hide a certain field/method in the
IntelliSense. However, as far as I know, there isn't such attribute
available to hide the method. The only way is to make it private.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
OK, tnx! :)

Although, I've heard that ie. the CheckedListBox (i think in the
System.Windows.Forms namespace) has a DataSource property that isn't
shown... how did MS do that? :P (You can assign to it and make it work, but
it doesn't exist according to the docs or intellisense)

L-E
 
Back
Top