Droezel
asked on
C# Inheritance & Intellisense : accessing base class methods
Hi,
Does this just not work in C#?
I have a base class with a method, let's say BaseMethod.
Also a class that inherits from the base class, let's call it InheritClass with a method InheritClassMethod.
In another class, I instantiate the InheritClass, eg. InheritClass myInheritClass = new InheritClass();
The problem : when I type in a C# project : myInheritClass. *dot* the intellisense pops up. But intellisense shows only InheritClassMethod, but it doesn't show BaseMethod.
Why?
When I type myInheritClass.BaseMethod, the project compiles and runs with no errors. So it's just the intellisense that doesn't show this. In VB.Net intellisense does show this method BaseMethod.
Is there a solution to solve this in C#?
Does this just not work in C#?
I have a base class with a method, let's say BaseMethod.
Also a class that inherits from the base class, let's call it InheritClass with a method InheritClassMethod.
In another class, I instantiate the InheritClass, eg. InheritClass myInheritClass = new InheritClass();
The problem : when I type in a C# project : myInheritClass. *dot* the intellisense pops up. But intellisense shows only InheritClassMethod, but it doesn't show BaseMethod.
Why?
When I type myInheritClass.BaseMethod,
Is there a solution to solve this in C#?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What does the class code look like?
Bob
Bob
ASKER
Cleaning up, recompile and restart works indeed. However the situation keeps comming back al the time. Guess C# intellisense is a bit buggy? Thanks
I think that this is just down to your IDE (or, the intellisense utility which you're using); for some reason, it isn't recognising any inherited functionality. It is very strange that it is fine with VB .NET, but it's quite obvious that most IDEs use different systems for different languages, perhaps you're just unlucky that the C# systems' intellisense doesn't support inheritance.
As you say, it compiles fine, so clearly the functionality is being inherited.
What IDE/intellisense utility are you using?
Regards;