问题
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