user47589
user47589

Reputation:

Visual Studio 2010 listing the same enum twice in intellisense

I'm using Visual Studio 2010 Professional. In this question, CardSet is an enum declared in the "Entities" namespace.

When I start typing in "Car", if I hit tab the auto-completion always becomes Entities.CardSet instead of just CardSet. This is occurring in a class method declared in the same namespace as the enum.

The enum is listed twice in Intellisense:

The source files for the enum and for the class being edited are in different folders. CardSet is declared only once. There is not a separate CardSet enumeration in a second namespace.

What is odd is code generated by "Implement abstract class" doesn't use the namespace - it correctly uses the shorter CardSet.

How can I get Visual Studio to get Entities.CardSet out of Intellisense so I can just type in
"Car +Tab"? I have tried restarting Visual Studio to no effect.

Upvotes: 2

Views: 239

Answers (2)

Jon Skeet
Jon Skeet

Reputation: 1503934

It's not listing the enum twice. It's listing two entries because there are two different things you might want to refer to: the CardSet property/field within your type, or the enum type itself (Entities.CardSet) to then refer to a specific member of the enum. Note how the icons are different.

The behaviour doesn't seem unreasonable to me - is it really affecting your productivity that much? If you really don't want to type all seven characters, just select the right value from the dropdown.

Upvotes: 2

user47589
user47589

Reputation:

I just facepalmed. It's because there's a property on the class also called CardSet. I need to fix that. I just noticed the icons in Intellisense are different: one is for a property while the other is for an enum.

Upvotes: 2

Related Questions