有没有办法改变的构造函数的在Visual Studio中的智能感知列出的顺序?没有办法、函数、顺序、智能

2023-09-03 04:44:50 作者:你给的痛几吨重

我定义一个类有多个构造函数,使底层接口是不可改变的,一旦对象实例化。我想一个构造函数是默认构造一个用户类型在Visual Studio中以下时:

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(

目前,当我去到实例化对象,在构造函数中未列出(在Visual Studio智能感知)在我在我的类中声明的顺序。有没有一种方法,以纪念我的构造,使他们的方法实例在Visual Studio智能感知期间出现在一个特定的顺序?

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?

推荐答案

有没有一种方法来控制在Visual Studio的智能感知的顺序。如果你有多个构造函数(或方法),在智能感知方面的唯一真正的控制是使用 EditorBrowsable 用合适的EditorBrowsableState.这使您可以隐藏构造器(或方法)的智能感知,还是只把它显示在高级模式,但不会让你重新排序。

There isn't a way to control the ordering within Visual Studio's Intellisense. If you do have multiple constructors (or methods), your only real control in terms of intellisense is to use EditorBrowsable with the appropriate EditorBrowsableState. This allows you to hide a contructor (or method) in intellisense, or only have it displayed in "advanced" mode, but does not allow you to reorder them.

然而,在这种情况下,如果你打靶.NET 4中,我建议你考虑使用一个构造函数,并利用的