How to get Visual Studio Intellisense to detect an inherited subclass?

I have a scenario where Visual Studio (2012) Intellisense does not recognize a subclass that is defined in an inherited class. This is probably best demonstrated with a simple example:

public class Shape { public class SubShape { } } public class Circle : Shape { } 

So, I have a Shape class with a subclass of SubShape and Circle that inherits from Shape.

If I then try to create an instance of SubShape with new Circle.SubShape() , I do not get results from Visual Studio Intellisense after new Circle. . Everything builds correctly, without syntax errors.

If I refer to a class from the base class with new Shape.SubShape() , Intellisense works. It also works if I initially left the new keyword - so entering Circle. presents me with SubShape as an option.

I am using Visual Studio 2012, version 11.0.61030.00 Update 4 .

Update: I have ReSharper disabled, but if I turn it on and you want to use ReSharper Intellisense instead of Visual Studio, everything will work as expected.

+6
source share
1 answer

Probably an Intellisense error (very minor) also occurs in VS2010.

Oddly enough, the declaration of the do variable has Intellisense, i.e.

 Shape.SubShape s; Circle.SubShape s; 

when you typed, Subshape will display after the point.

0
source

All Articles