Visual Studio - 在隐藏代码中搜索对象使用情况的快速方法

发布于 2024-08-04 23:56:50 字数 475 浏览 4 评论 0原文

在Visual Studio中,有没有一种快速的方法可以在后面的代码中搜索对象的用法? 这是我经常做的事情,而我目前的做法似乎有点笨拙。

我正在使用 VS2005、WinForms、VB 和 CodeRush/RefactorPro。

目前我执行以下步骤: 在设计视图中

  1. 单击对象。
  2. 在属性对话框中,双击对象的名称
  3. 将其复制到剪贴板(使用 Ctrl-C 或右键单击并选择复制)
  4. 按 F7 调出编辑器后面的代码
  5. 按 Ctrl-Home 定位到文件顶部。
  6. 按 Ctrl-F,将弹出查找对话框
  7. 按 Ctrl-V,将对象名称粘贴到“查找内容:”文本框中。
  8. 点击 ENTER 开始查找。

理想情况下,我想单击设计视图中的对象,然后按热键 执行这些其他步骤。

如果VS2005没有内置任何东西,我应该研究使用宏吗?

In Visual Studio, is there a quick way to search for an object's usage in the code behind?
This is something I do constantly and the way I am currently doing it seems a little clunky.

I am using VS2005, WinForms, VB and CodeRush/RefactorPro.

Currently I do the following steps:
In Design View

  1. Click the Object.
  2. In the Properties Dialog, double click the Name of the object
  3. Copy it to the clipboard (Using Ctrl-C or Right Click and selecting Copy)
  4. Press F7 to bring up the code behind editor
  5. Press Ctrl-Home to position to the top of the file.
  6. Press Ctrl-F, which brings up the Find Dialog
  7. Press Ctrl-V, to paste in the name of the object into the "Find what:" text box.
  8. Tap ENTER to start the Find.

Ideally, I would like to click the object in Design View then hit a hot key
to do these other steps.

If VS2005 does not have anything built in, should I research using a Macro?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冰之心 2024-08-11 23:56:50

我不知道类似的功能,内置的 Visual Studio,但是,您可以使用精彩的插件 JetBrains 的 Resharper 具有该功能以及许多其他出色的功能...

还有另一个名为 CodeRush,我没用过,但似乎值得一看。

I don't know about any functionality like that, built-in visual studio, however, you can use the wonderful plugin Resharper from JetBrains which has that functionality, as many other excellent features...

There is also another add-on called CodeRush, I haven't used it but it seems to be worth a look.

清风夜微凉 2024-08-11 23:56:50

如果允许使用第 3 方插件,请安装 R# 并使用“查找用法”工具。尽管不确定 R# 是否仅仅为了这个功能就值得。

If 3rd party addons are allowed, install R# and use the Find Usages tool. Although not sure R# would be worth it just for this feature alone.

心碎的声音 2024-08-11 23:56:50

Tab 到下一个引用 - CodeRush 或 CodeRush Xpress

此功能允许您循环浏览对标识符的所有引用,只需将插入符号放在标识符中并点击 [TAB]

查找所有引用 - CodeRush

在 CodeRush 中使用 [Shift-F12] 组合将打开“引用”工具窗口,该窗口将显示当前插入符号处的标识符的所有引用。

Tab To Next Reference - CodeRush Or CodeRush Xpress

This feature allows you to cycle through all references to an identifier simply by placing your caret within the identifier and hitting [TAB]

Find All References - CodeRush

The use of the [Shift-F12] combo in CodeRush will bring up the References toolwindow which will then display all references to the identifier currently at the caret.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文