C# Visual Studio:如何在 IntelliSense 中显示重载?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9891656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 11:05:58  来源:igfitidea点击:

Visual Studio: How to show Overloads in IntelliSense?

c#visual-studiovisual-studio-2010

提问by jp2code

Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Parenthesis ()and reopening them.

编写代码后,我所知道的查看方法重载的唯一方法是通过删除括号()并重新打开它们来实际编辑方法。

Is there a shortcut key that I could press to activate this instead of having to edit my files?

是否有一个快捷键可以让我按下它来激活它而不必编辑我的文件?

For an example, please reference the ShowDialog Overloadscreen shot below:

例如,请参考下面的ShowDialog Overload屏幕截图:

ShowDialog1 Overloads

ShowDialog1 重载

采纳答案by aardvarkk

Try the keyboard shortcut Ctrl-Shift-Space. This corresponds to Edit.ParameterInfo, in case you've changed the default.

试试键盘快捷键Ctrl- Shift- Space。这对应于Edit.ParameterInfo,以防您更改了默认值。

Example:

例子:

descriptive screenshot, by jp2code

描述性屏幕截图,由 jp2code

回答by Neil Knight

Ctrl+Shift+Spaceshows the Edit.ParameterInfofor the selected method, and by selected method I mean the caret must be within the method parentheses.

Ctrl+ Shift+Space示出了Edit.ParameterInfo所选择的方法,以及通过选择的方法我指的是插入符号必须是该方法在括号内。

Here is the Visual Studio 2010 Keybinding Poster.

这是Visual Studio 2010 键绑定海报

And for those still using 2008.

而对于那些仍在使用2008 的人

回答by Alex In Paris

Tested only on Visual Studio 2010.

仅在 Visual Studio 2010 上测试。

Place your cursor within the (), press Ctrl+K, then P.

将光标置于 () 内,按Ctrl+ K,然后按P

Now navigate by pressing the  ↑  / ↓  arrow keys.

现在按 ↑  / ↓  箭头键进行导航。

回答by KeithS

Great question; I had the same issue. Turns out that there is indeed a keyboard shortcut to bring up this list: Ctrl+Shift+Space (a variation of the basic IntelliSense shortcut of Ctrl+Space).

好问题;我遇到过同样的问题。事实证明,确实有一个键盘快捷键可以调出此列表:Ctrl+Shift+Space(Ctrl+Space 的基本 IntelliSense 快捷键的变体)。

回答by JaredPar

The default key binding for this is Ctrl+Shift+Space. The underlying Visual Studio command is Edit.ParameterInfo.

默认的键绑定是Ctrl+ Shift+ Space。底层的 Visual Studio 命令是Edit.ParameterInfo.

If the standard keybinding doesn't work for you (possible in some profiles) then you can change it via the keyboard options page

如果标准键绑定对您不起作用(在某些配置文件中可能),那么您可以通过键盘选项页面进行更改

  • Tools -> Options
  • Keyboard
  • Type in Edit.ParameterInfo
  • Change the shortcut key
  • Hit Assign
  • 工具 -> 选项
  • 键盘
  • 输入 Edit.ParameterInfo
  • 更改快捷键
  • 点击分配

回答by mikus

It happens that none of the above methods work. Key binding is proper, but tool tip simply doesn't show in any case, neither as completion help or on demand.

碰巧上述方法都不起作用。键绑定是正确的,但工具提示在任何情况下都不会显示,无论是作为完成帮助还是按需。

To fix it just go to Tools\Text Editor\C#(or all languages) and check the 'Parameter Information'. Now it should work

要修复它,只需转到Tools\Text Editor\C#(或所有语言)并检查“参数信息”。现在它应该工作

回答by Dave

  • The command Edit.ParameterInfo(mapped to Ctrl+Shift+Spaceby default) will show the overload tooltip if it's invoked when the cursor is inside the parameter brackets of a method call.

  • The command Edit.QuickInfo(mapped to Ctrl+KCtrl+Iby default) will show the tooltip that you'd see if you moused over the cursor location.

  • 如果在光标位于方法调用的参数括号内时调用该命令Edit.ParameterInfo(默认映射到Ctrl+ Shift+ Space)将显示重载工具提示。

  • 该命令Edit.QuickInfo(默认映射到Ctrl+ KCtrl+ I)将显示您将鼠标悬停在光标位置上时会看到的工具提示。

回答by Phylliida

Every once and a while the suggestions above stop working, if I restart Visual Studio they start working again though.

每隔一段时间,上面的建议就会停止工作,但如果我重新启动 Visual Studio,它们又会重新开始工作。

回答by Ylenia88m

I know this is an old post, but for the newbies like myself who still hit this page this might be useful. when you hover on a method you get a non clickable info-box whereas if you just write a comma in the method parenthesis the IntelliSense will offer you the beloved info-box with the clickable arrows.

我知道这是一篇旧帖子,但对于像我这样仍然点击此页面的新手来说,这可能很有用。当您将鼠标悬停在某个方法上时,您会得到一个不可点击的信息框,而如果您只在方法括号中写一个逗号,IntelliSense 将为您提供带有可点击箭头的心爱信息框。

回答by eaglei22

Mine showed up in VS2010 after writing the first parenthesis..

在写第一个括号后,我的出现在 VS2010 中。

so, prams.Add(

所以,婴儿车。添加(

After doings something like that, the box with the up and down arrows appeared.

做完这样的事情后,出现了带有上下箭头的框。