Thursday, October 2, 2014

Visual Studio 2014–New features


Visual studio 2014 CTP is now available for download. You can download it from here.

With the new release there are some new language & IDE features introduced. I will discuss some of IDE improvements in this post.

IDE Improvements

1. Colored quick info

when you hover over on something in your code now the quick info window has information with colors.


also if you collapse your code & hover over to see the code inside so you can see the code with all colored formatting in the tool tip.


2. Hint with un-used references

When we create a class there are few references which are automatically added. Also there are some cases we add some piece of code which need some other references & sometime back we remove that code but we don’t remove the reference.

Now Visual studio grey out those references & give option to remove those.


3. Hint with redundant qualifiers

In your code if you have already added the reference in your code & have used the namespace when when initializing objects of the classes in that namespace those are also highlighted & options are given to remove those. And it will show how the code will looks like when the fix is applied.


4. Show Refactoring options

Now visual studio provides some hints to refactor. Also it shows how code will look like when the refactoring is applied. Also in gives some windows which improved options for refactoring.

Will take the following code as an example.

  1. class Program
  2.   {
  3.       static void Main(string[] args)
  4.       {
  5.           User user = new User().GetUser();
  7.           string result=  string.Format("Age is {0}, Retirement in {1} years",
  8.                             user.age, (65 - user.age));
  9.           Console.WriteLine(result);
  10.           Console.ReadLine();
  11.       }
  12.   }
  15.   public class User
  16.   {
  17.       public int age { get; set; }
  19.       public User GetUser()
  20.       {
  21.           User user = new User();
  22.           user.age = 26;
  24.           return user;
  25.       }
  26.   }

so there you can see when taking the result string there is a duplicate code when taking user age. so if u highlight that code & click “ALT”+”.” it will show you the refactoring options.


there we can introduce a new local variable for that. When local variable is introduced it gives option to rename the variable also it highlights & shows it get renamed in every place.








also when you rename if that name conflicts with any existing variable it will show that as well.

ex: if we rename age as args


also it gives options to extract methods and some other refactoring options with many other improved options.


so if you are familiar with Re-sharper you might have used this options before. Now these are shipped with visual studio so you don’t need to buy licenses of another third party tool Smile.

Lets see some language improvements in the next post.

Until that……

Happy Coding Laughing out loud