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.
- class Program
- {
- static void Main(string[] args)
- {
- User user = new User().GetUser();
- string result= string.Format("Age is {0}, Retirement in {1} years",
- user.age, (65 - user.age));
- Console.WriteLine(result);
- Console.ReadLine();
- }
- }
- public class User
- {
- public int age { get; set; }
- public User GetUser()
- {
- User user = new User();
- user.age = 26;
- return user;
- }
- }
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 .
Lets see some language improvements in the next post.
Until that……
Happy Coding
Great
ReplyDeleteDot Net Online Training
online dot net training from india