In this article, we will look into a new feature of Visual Studio 2013 that helps to edit and view code present in various files without switching among the windows.
In this article, we will look into a new feature of Visual Studio 2013 that helps to edit and view code present in various files without switching among the windows. This will help us to write code faster without jumping from the code that you're writing. Let's create a sample Console Application in Visual Studio 2013 and explore it further with the following piece of code:We are calling two methods from the Main method. "MethodA()" is present in the "Program.cs" file and "MethodB()" is in the "TestPeek.cs" file. Prior to Visual Studio 2013, we use "Go to Definition" for editing "MethodB()" that will take us away from the code that you're writing to a new window. In Visual Studio 2013, we can edit the code in the same place without switching to a new window by pressing the "Alt + F12" shortcut or clicking on "Peek Definition" as shown below:This will show the definition of MethodB() in the same window for editing as shown below:Once we are done with editing, we can save and press the "Esc" button to close the Peek Definition window. We can press on to open the file having the definition of "MethodB()" in a new document window. We can even nest Peek Definition windows as shown below:Here, we opened "MethodA()" in a Peek Definition window, that opened "MethodB()" in another window and can navigate backward and forward using breadcrumb dots within the window.This feature can also be used on classes as well to edit within the current window as shown below: The keyboard shortcuts for this feature:
We can use this feature to edit a class or method in the current editor without switching from the code that you're writing.
Printing in C# Made Easy