Difference between Goto Definition and Goto Implementation in Visual Studio

妖精的绣舞 提交于 2019-12-05 14:50:45

问题


What is the difference between Go To Definition and Go To Implementation in Visual Studio?

Version: Visual Studio 2015 Update 1


回答1:


Let's say we have this interface:

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

And a class that implements this 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);
    }
}

If we right click on IEmailSender and choose Go To Implementation, Visual Studio navigates us to the class that implements this interface, namely AuthMessageSender.
If we right click on IEmailSender while we are in AuthMessageSender class and
choose Go To Definition, Visual Studio navigates us to the definition of the IEmailSender.



来源:https://stackoverflow.com/questions/34433800/difference-between-goto-definition-and-goto-implementation-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!