Visual Studio“转到实施”

发布于 2024-09-12 16:38:25 字数 81 浏览 3 评论 0原文

在方法调用上单击鼠标右键,我们会看到一个上下文菜单,其中包含“转到定义”和“转到实现”选项等选项。

为什么有时会缺少“转到实施”选项?

On a right mouse click on a method call, we get a context menu with options "Go to definition" and "Go to implementation" options among others.

Why is the "Go to implementation" option sometimes missing?

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

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

发布评论

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

评论(4

海拔太高太耀眼 2024-09-19 16:38:25

对于 Visual Studio 2015,有以下扩展:转到实施

它是一个扩展,允许转到所选类、方法或属性的实现(在使用接口时很有用)。与 ReSharper 功能类似。

输入图片此处描述

它还支持多种实现

在此处输入图像描述

For visual studio 2015, there is this extension: Go To Implementation

It's an extension that allows to go to the implementation of the selected class, method or property (useful when using interfaces). Similar to the ReSharper feature.

enter image description here

It also supports multiple implementations when found

enter image description here

乖乖兔^ω^ 2024-09-19 16:38:25

当然已经存在于 Visual Studio 中!从那时起它就在那里。

右键单击您的代码(例如:属性)并选择“查看调用层次结构”。在 Call Hierarchy 窗口中选择 Implements 文件夹。

你就在那里。为什么要Reshaper???
当然,并不像 resharper 的实现那么复杂,它允许直接询问接口,但只有该接口的属性或方法就足够了。例如:

public interface IModule
{
int Count { get; set; }
}

public class Module : Imodule
{ 
  public int Count {get; set;}
}

public class Module2 : Imodule
{ 
   public int Count {get; set;}  
}

右键单击属性(任何位置 - 类内部或接口内部)并选择“查看调用层次结构”,应该说明哪个类实现它们,从而说明整个接口。

一开始我们都喜欢Resharper,随着时间的推移,我们都讨厌它!

Of course already exists in Visual Studio ! It is there since ever.

Right click on your code (Ex: property) an select "View Call Hierarchy". In Call Hierarchy window select the Implements folder.

There you are. Why Resharper ???
Of course is not that complex as go to implementation from resharper which allows direct interrogation on interface, but only a property, or a method from that interface should be enough. Ex:

public interface IModule
{
int Count { get; set; }
}

public class Module : Imodule
{ 
  public int Count {get; set;}
}

public class Module2 : Imodule
{ 
   public int Count {get; set;}  
}

Right click on the property (anywhere - inside the class or inside the interface) and select "View Call Hierarchy", should say which class implements them, and therefore the whole Interface.

At the beginning we all love Resharper, with time, we all hate it !

离旧人 2024-09-19 16:38:25

ReSharper 上下文菜单项“转到实施”仅在以下情况下显示基础成员有一个实现。

它并没有出现在每个地方,因为 ReSharper 没有发现自己位于已实现的基础成员上。

http://www.jetbrains.com/resharper/features/navigation_search.html#转到实施

This ReSharper context menu item "Go To Implementation" only shows up if there is an implementation for the base member.

It is not shows up in every place because ReSharper does not find itself on the base member that has been implemented.

http://www.jetbrains.com/resharper/features/navigation_search.html#Go_to_Implementation

如痴如狂 2024-09-19 16:38:25

我认为当您单独加载不属于项目的文件时,有时会发生这种情况。当您创建 VC++ 项目时,Visual Studio 会生成一个智能感知数据库。旧版本为 *.ncb,2010 年为 *.sdf

I think that happens sometimes when you load a file individually that isn't part of a project. When you make a VC++ project, Visual studio generates an intellisense database. *.ncb in older versions, and *.sdf in 2010

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