Is there a way to change the order of constructors listed in IntelliSense in Visual Studio?

Viewed 1690

I have defined a class with multiple constructors so that the underlying interfaces are immutable once the object is instantiated. I would like one of the constructors to be the "default" constructor for when a user types the following in Visual Studio:

var obj = new MyClass(

Dim obj As New MyClass(

Currently when I go to instantiate the object, the constructors aren't listed (in Visual Studio IntelliSense) in the order I declared them in my class. Is there a way to mark up my constructors so that their methods appear in a particular order during instantiation in Visual Studio IntelliSense?

5 Answers

It looks like there still is no way to dictate the order as an application developer. It appears IntelliSense sorts first on the number of arguments, disregarding whether an argument is optional or not (it counts either way).

If you have optional arguments you can rework them to overloads though, thus creating a new method/constructor with less parameters which will then appear earlier. You can also hide constructors that are useless to an application developer by declaring them internal.

Using these methods I could fix my little problem. I had a deserializing constructor that popped up before the more commonly used one.

Related