New features in Visual Studio 2010


In this article I am writing about couple of new features of Visual Studio 2010. The features are usefull to dvelopers yet many of the developers are not aware of such feature inclusion. This is my attempt to introduce couple of features that are useful to the developer in their day to day coding activity.


There are so many new features introduced in the VS 2010. Each individual will have
their own liking and style of coding, having said that all new feature introduced
with the VS 2010 may not be equally useful to each one of us.



Below are some of the new features that I think are most useful, in no particular
order.



1. Block selection



The block selection of the text in the code edition has been enhanced in the VS
2010. In new editor you can select the block and insert the new text on every selected
line.



Let me explain what I am saying, for example let us say we have bunch of variable
declaration like below


block selection code sample


At some point of time, let say you feeel that all the above listed variables needs
to be declared as public instead of private.


All you need to do is block select the private key words on different lines, by
holding Alt key down and moving the mouse as shown below. While you have selected
the private keyword on all the lines, type "public", you are done all private are
changed to public.


block selected code sample


2. Call Hierarchy



I found that call Hierarchy is a good feature, especially when you are debugging
some other's code. This feature allows you to find calls that are going out
and coming into a method. The nearest feature in the VS 2008 would be
find
all references.



To see the call hierarchy select the method name and press
Ctrl
+K , Ctrl+T
or right click on the method name and select "View Call Hierarchy".
It will show you a Call hierarchy window as below.


call Hierarchy window


3. Zoom



In VS 2010 code editor we can zoom in and zoom out, by holding down
the Ctrl and rolling the mouse roller.



This is quite usefull feature when you are presenting your code sample. Otherwise
often than not we end up increasing font size of the code editor during demo session.



4. Generate From usage



One another feature that is enhanced or improved
is, generate from usage features. Till VS 2008 we had the ability where you can
generate the stubs for a method that you type in your code.



For e.g if you have class MyClass
that
do not have a method by name MyMethod .



If you realize while coding that you need a method called MyMethod
on MyClass, you can go ahead and type is as if that method is already
available, like below.


generate from usage


A small blue rectangle appears at the left bottom of the method name
as shown above. If you mouse over the blue rectangle you will be presented with
an option to generate the method stubs as below.


generate from usage demo


By choosing that option you can generate the stub for MyMethod on class="SpellE">MyClass without leaving your current code window, meaning
less distraction while you are coding.



In VS 2010 this feature is taken to one level up where
you
have ability to generate the stubs for class itself.
Also it is possible to generate stubs
for Property, field and a new type (enum, interface and
struct
) in addition to method stub.



Below shown are the options



Generating class or type stub\


generate type


Generation field or property stub



generate property



Note: You can also use the short cut Ctrl + . instead
of mouse overring the blue rectagle


Comments

Author: Prachi Kulkarni29 Apr 2012 Member Level: Gold   Points : 0

Hi,
Very much informative and useful.

Regards,
Prachi.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: