c# - Visual Studio 中 Goto 定义和 Goto 实现的区别

标签 c# .net visual-studio visual-studio-2015 go-to-definition

在 Visual Studio 中 Go To DefinitionGo To Implementation 有什么区别?

版本:Visual Studio 2015 Update 1

最佳答案

假设我们有这个接口(interface):

public interface IEmailSender
{
    Task SendEmailAsync(string email, string subject, string message);
}

还有一个实现这个接口(interface)的类:

public class AuthMessageSender : IEmailSender
{
    public Task SendEmailAsync(string email, string subject, string message)
    {
        // Plug in your email service here to send an email.
        return Task.FromResult(0);
    }
}

如果我们右键单击 IEmailSender 并选择 Go To Implementation,Visual Studio 会将我们导航到实现此接口(interface)的类,即 AuthMessageSender
如果我们在 AuthMessageSender 类中右键单击 IEmailSender
选择 Go To Definition,Visual Studio 会将我们导航到 的定义code>IEmailSender.

关于c# - Visual Studio 中 Goto 定义和 Goto 实现的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34433800/

相关文章:

c# - 在客户端打印而不显示打印对话框

visual-studio - 安装新版本软件时如何消除 "The specified service already exists"?

c# - VStudio 2019 中缺少 “Merge changes in merge tool” 、 “Take server version” 等按钮

c# - Entity Framework 在应用 Where 过滤器时是否选择内存中的所有行?

c# - 如何在修正绑定(bind)属性后立即更新TextBox?

c# - 将局部四元数旋转转换为全局(陀螺仪)

c# - 在 C# 中引用多个 Web 服务时解决类型歧义

c# - 如何根据 xpath 中的日期范围选择节点?

C# 线程 - 以线程安全的方式使用类与以线程安全的方式实现它

c# - 捕获控制台输出以在 VS 中进行调试?