views:

68

answers:

1

Hello,

I have a class with both a overloaded constructor and a overloaded method.

If I initiate the class with parameters, the idea would be that I then didn't need to fill this information into my method. But as things grow it can get a bit confusing.

I wanted to know if there is a way of either telling C# or Visual Studio not to show the method in the IntelliSense if a certain constructor is called, hopefully in a clean and neat way without any "hacks".

Thanks in advance.

+7  A: 

No, you can't change the behavior of IntelliSense that way.

The issue you're facing is actually a code smell regarding your class design.

If you have certain methods that aren't of any use unless a given constructor was used, you should probably split the class so that the different functionality is clearly delineated.

It might make sense to have a base class of the common behavior and subclasses for each of the different types of constructors. This would effectively do what you're asking for, and follow proper object-oriented design.

Ben S
+1. Great answer.
Roman Boiko