Tuesday, March 3, 2009

C# IDE Tips & Tricks: Part I

Posted on/at 6:44 AM by Admin

C# Developers has been spending most their day activities with Visual studio IDE. They may have to understand the following activities to do their job.

  • Understanding Code: Developer must be able analyze the relationship between classes and what API it is using for implementing the logic.
  • Navigating Code: Developer may or may not know where he want to navigate to the code and keep track of visited files in the code.
  • Writing & Modifying Code: Developers may require to modify the existing code like refactoring which involves make the code readable and fix bugs etc
  • Debugging & Testing: Understanding the using of debugger tools and writing unit test cases.

Visual studio provides the tools for all the activities mentioned above to make the developer efficient and productive. This post speaks about using the tools available in 
VS 2008 sp1. It also discusses about the tool coderush express which Microsoft partnering and allows the developers to download and use freely.

Download Coderush for C#

1. One of the short cut for goto definition is F12
For example you have an identifier and you want to know where it is declared just press F12. If the identifier is not your project then it shows the metadata of the identifier. eg we are viewing string class

clip_image001
2. When you bring the code definition windows by Ctrl + W, D  you will see the following picture

clip_image002
When you move the code on top window it shows the declarations in the code definition window.
You can use Ctrl + Shift, 8 to come back from the declaration. F12 is for go to the definition of window and Ctrl + Shift, 8 is to come back to the origin.
You can also view the Navigation stack by Ctrl -.

3. To find all the references in your project for a particular method or type you can use Shift + 12 which shows the following window in IDE

clip_image003
To navigate to the references list window you  can use F8.
4. Some times when you are working on a really big project and you want to know which file you are actively using and you want know where it is in solution explorer. You can find the file in the solution explorer by going to Tools-Options dialogue box and selecting the General option under the projects solutions.

clip_image004
You can track the active item in solution explorer by checking the above option.
5. Code rush express short cut when you want to go to the file use

Ctrl + Alt + F you will get the following window

clip_image005
It also filters the files based on the input and camel case.

If you want to go to any type or method in your project then you can use coderush shortcut   Ctrl + Shift , Q it show the following window

clip_image006
If you want to see the identifier where it is used in the project you can use

Ctrl + Alt , U.  you can use tab key to navigate between the identifiers.

clip_image007
6. To navigate to the open files in the IDE you can use Ctrl  + Tab

clip_image008
You can also use Ctrl + Alt + Down to bring the following window

clip_image009
7. Viewing the class designer

clip_image010
You can view the class designer of the class and it dynamically updated whenever you change the class in code definition window.

Summarizing what we have learned so far

clip_image011

clip_image012

In the next post I will explain about more tips.

Source: http://www.c-sharpcorner.com/UploadFile/kalisk/Csharptips11092008174635PM/Csharptips.aspx

0 comments:

Post a Comment

About Me

Developers house is a blog for posting technical articles in different technology like Microsft, Java, Oracle ..etc Microsoft technology includes c#,VB.net,ASP.net,Ajax,SilverLight,TFS,VS.NET 2003,2005,2008,2010 , SQL Server 2000, 2005 , Expression Blend , ...etc I hope it is helpful for all of you and if you are interested to post articles on it, only send me at ahmad.eed@gmail.com