Wednesday, March 16, 2011

Visual Studio 2010 Tips and Tricks # 2 : Resolve Namespaces

 

  • With Visual Studio 2010 there is a new feature available called “Resolve”.
  • Using “Resolve”, you can automatically add using statements to a class.
  • Shortcut key to invoke this is => Press Ctrl key and “.” key and automatically the namespace will be added.
  • Shown below in this picture, when we enter “DataSet” and if we press “Ctrl” and “.” keys it automatically shows all the namespaces which have the “Data Set” class.

Resolve_1

 

  • We can move up and down using arrow keys to select the right namespace and then if we click enter, that using statement is automatically added to our using section at the top – “How cool !” Nerd smile

Resolve_2

  • Follow my blog for more tips and tricks like this Angel

Visual Studio 2010 Tips and Tricks # 1 : Navigate To

 

  • With Visual Studio 2010 there is a new feature available called “Navigate To”.
  • Using “Navigate to”, you can search for a file name (or) object name (or) method name in your entire solution.
  • Shortcut key to invoke this is => Press Ctrl key and “,” key to bring up the dialog (like shown below), then start typing your search term and it will auto-fill.

 

Navigate_To

  • In the above picture we can see that it lists filenames that start with “Default” like “Default.aspx” & their entire path location as well as it shows all the classes which have “Default” in their name like example “_default” and also it shows all properties “UseDefaultCredentials”.
  • Also if we click on the search result row, it shows the exact file name and the line number.
  • This is very useful to search in solutions which have lots of projects and files.
  • If you are lazy to type, click on the text and press “Ctrl” and “,” key and it even auto-fills the search text. (like shown below in this image).

 

Navigate_To_1