Three Incredible Changes in Visual Studio 2015 Makes Development Easy

Hi guys. I am back with the top changes in Visual Studio 2015's context menu, by which we can develop applications very easily. In this article we'll see how to use the new options in Visual Studio 2015. Let's see:

  1. Quick Action
  2. Rename
  3. Peek definition

visual studio

This is the new context menu in Visual Studio 2015 in the “.cs” code file and I marked all the new options in the following list.

Peek definition

So let's see how to use all of them. Go to Visual Studio 2015 and create a project to test all of them.

Quick Action… (Light Bulb)

Quick Action is a new concept in Visual Studio 2015 that provides new reflector attributes and also provides preview windows. Let's see how to use that with a new project in Visual Studio 2015.

Start Visual Studio 2015 and select "File" -> "New" -> "Project...".

console application

I just created a new project and opened the code file program.cs, and when I click on the using statement I see a light bulb -- that is the icon of Quick Action.

Quick Action

Click on the light bulb and it'll show you the option to Remove Unnecessary Using Statements with Preview window.

When I click on Preview Changes link it will open the Preview Changes window and will show the new code output after applying the changes.

apply

Let's see the new example of Quick Action. If I just write the following statement to create an object of the employee class, but I don't have any class "Employee Class" in the current project or solutio, then the compiler will return an error.

mail function

The error will be “Employee” could not be found.

Employee

And we also have a Quick Action Link in the same statement, and if I click on that then that will show you multiple options to remove the error with the preview changes link button window.

preview

If you select any option from them and click on a Preview Changes link button then that will show the new code file again that can be in your solution after apply.

preview code

Rename

Rename is a new option in Visual Studio 2015 context menus. It's very useful for renaming a class, function, constructor, property and much more. In Visual Studio 2015 we can use that with the shortcut key Ctrl+r. In the new Visual Studio 2015 we are also able to rename any text into a string or comment line. That was not possible in the previous versions of Visual Studio so let's see how to use that. Create a class then rename that.

rename

We have a class Employee that must be renamed from Employee to Emp.

Employee to Emp

Right-click on the word that we need to rename and then you'll see a new option in the Visual Studio context menu for Rename…

rename employee

Click on the Rename Option and that will open a new window and check all the options that you want to apply.

Check all the option

Finally Click on Apply to get the changes in your code files.

Peek definition

In previous versions of Visual Studio if we want to get the definition of a type, function, or a class defined in a DLL file then we can see that code using the F12 key or by right-clicking then clicking on “Go To Definition” but that will show you the code in a new tab, so we need to return from that class file to the class file where we were,  so it's complicated to move from one code file to an other code file again and again.

go to defination

Now in Visual Studio we have the new Option Peek Definition to show the definition of any class, type, or function in the same code file so now there is no need to navigate anywhere from one to another code file. This this is known as Preview Window, so now go and right-click on any class or function name of which definition we must see.

click Peek Definition

After clicking on Peek Definition now see the definition of that specific type or function in the same code file. So it's a very useful option for all developers to use Go to Definition.

class

And we have also some new changes in the debugging modes in Visual Studio 2015, so if you want to read about all the new features for debugging in Visual Studio 2015 then read my article.

Debugging and Diagnostics Enhancements in Visual Studio 2015.

Thanks.

Up Next
    Ebook Download
    View all
    Learn
    View all