Friday, April 30, 2010

Generate from using - creating stubs first in VS 2010

A feature that every one loved in VS 2005 is to just type in you class and press Alt+Shift+F10 and Visual studio shows you the options to add the using statements.

VS 2010 this has been extended, to create class stubs for you while you code.

For an example, if I want to use a class called Person in my code and if the Person class is not there yet in your code base, all you got to do is type the following.

Person p = new Person()

Press Alt+Shift+F10 and it will show an option asking if it should create the stub Person, if you say yes, VS will create the Person class for you in your current project.

Now next when you need to put a property into the Person class all you have to do is :

p.Name = "Jack";

again press Alt+Shift+F10, and tell VS to create the property, now in the person class you will see the property Name.

You can do the same to generate method stubs as well.

No comments:

Post a Comment