What is the difference between Go To Definition
and Go To Implementation
in Visual Studio?
Version: Visual Studio 2015 Update 1
Navigate to implementation of a type or a type member Choose Navigate | Go To Implementation in the main menu, press Ctrl+F12 , or click the symbol while holding Ctrl+Alt keys. Note that in Visual Studio 2017 and later, the Ctrl+Alt -click is used for adding multiple carets.
Go to Implementation# Languages can also support jumping to the implementation of a symbol by pressing Ctrl+F12. For an interface, this shows all the implementors of that interface and for abstract methods, this shows all concrete implementations of that method.
You can use the Peek Definition command to view and edit code without switching away from the code that you're writing. Peek Definition and Go To Definition show the same information, but Peek Definition shows it in a pop-up window, and Go To Definition shows the code in a separate code window.
Navigate to implementation of a type or a type memberPress Ctrl+F12 or choose Navigate | Implementation(s) from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With