Click here to Skip to main content
13,350,486 members (49,148 online)
Click here to Skip to main content
Add your own
alternative version


6 bookmarked
Posted 8 Aug 2010

One of my favorite Visual Studio Shortcuts - Very useful !

, 8 Aug 2010
Rate this:
Please Sign up or sign in to vote.
How to use a single shortcut key “Ctrl+.” in different places of your development

“Ctrl + .” Or “ALT + SHIFT+F10” is one of my favorite shortcuts in Visual Studio. You can use the same shortcut for various situations as described below:

  1. Adding Namespaces automatically / Resolving Namespaces
  2. Generating Method Stubs
  3. Implementing Interface/ Abstract Class
  4. Generating Automatic Class Files
  5. Renaming Member variables or Classes

Let’s look at them one by one.

1. Adding Namespaces Automatically / Resolving Namespaces

If you are adding a new class in your code, you may need to add the correspondence namespace. To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code.

Let's consider that you want to add DataTable in your code, so for that you right click on that class and select resolve to resolve the namespace.


Figure: Use Right Click To Add Namespaces

But using “Ctrl+.” you can automatically add the using statement. See the below image.


Figure: Add namespace using Shortcut key.

2. Generating Method Stubs

You can also generate the methods stubs using the same shortcut key. Like, if you want to create a method which will add to number, you can write like AddTwoNumber() and press “Ctrl+.” and Enter to generate the Stub for your methods automatically.


Figure: Create Method stubs using “Ctrl + .”


Figure: Generated Stub for the methods.

The most interesting point is that it will generate the stubs based on the type of argument we are giving. As shown in the below picture, for the first argument, it has generated an integer and for the second, it's a generated string.


Figure: Generated stubs based on parameters.

3. Implement Interface/ Abstract Class

Like a similar process that we have used for the first two examples, you can implement all the Interfaces or Abstract classes using the same shortcut.

For example, you have a Class called student which implements Interface IStudentInfo. Instead of manually implementing all the properties or methods for the interface you can generate the interface stubs automatically.


Figure: Implement Interface


Figure: Implemented stubs for the interface

4. Generating Automatic Class Files

This is related to feature 3. If you are trying to implement one Abstract class or Interface which is not created, by using this shortcut key you can create the file automatically. You do not need any manual process to add the file. By using “Ctrl+.” and Enter a class files with the same name will be automatically added in App_Code Folder.


Figure: Generate new class/interface using shortcut key.


Figure: Automatically created files in App_Code.

5. Rename Member Variables or Classes

By using the same key “Ctrl+.”, you can also rename the same referenced variable at a time all over the application.


Figure: Renaming all referenced variables at a time.


In this blog post, I have explained how you can use a single shortcut key “Ctrl+.” in different places of your development. Hope this will help you.


Shout it

Filed under: General, Tips and Tricks, Visual Studio, Visual Studio 2010


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Abhijit Jana
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband

Blog :
Web Site :
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
Yazeed Hamdan23-Feb-15 12:04
memberYazeed Hamdan23-Feb-15 12:04 
GeneralMy vote of 4 Pin
aGISer2-May-13 2:53
memberaGISer2-May-13 2:53 
GeneralMy vote of 5 Pin
KunalChowdhury6-Sep-10 9:10
mentorKunalChowdhury6-Sep-10 9:10 
GeneralHey hey Pin
Pushkarr10-Aug-10 19:32
memberPushkarr10-Aug-10 19:32 
GeneralRe: Hey hey Pin
Abhijit Jana10-Aug-10 20:04
mvpAbhijit Jana10-Aug-10 20:04 
GeneralMy vote of 4 Pin
Nisha Agrawal9-Aug-10 0:14
memberNisha Agrawal9-Aug-10 0:14 
GeneralRe: My vote of 4 Pin
Abhijit Jana10-Aug-10 20:02
mvpAbhijit Jana10-Aug-10 20:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 8 Aug 2010
Article Copyright 2010 by Abhijit Jana
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid