Techbubbles

C# IDE Tips & Tricks Part 2

This post explains the some more tips on using Visual C# IDE to enhance developer productivity.

  • Solution Configurater  Right click your solution in your IDE then select the ConfigurationManager  you see the following window

 cmtemplate

where you have the option to select the project for building. We can select the required project in the solution and can you can build the project.

  • Solution Wide Comments You can add task lists and comments to your solution. To view the task list for your solution select view menu and click on TaskList option. Ctrl + W, T you will see the following window

tasklist

You can add the task list items to window by writing the following snippet in the code file.

//TODO Write some code 

Which really helps the developer to set reminders to write the code and also useful to suggest the developers to refactor the code by setting the TaskList comments.

The above snippet designer is a plug-in which integrated in to the visual studio IDE which adds a rich and productive experience to the developer.

It allows the developer to write a snippet in the IDE as follows

snippet

To insert a snippet for example to write class type class and double tab it inserts class template.

snp2

code snippets are really great way to build the code.

Ctrl + K, X is the short cut for insert snippet. You can use Shift + Tab to navigate the categories in the snippet.

  • Background Squiggles When you type some code in IDE and if the code having any errors it immediately shows an red mark under the identifier which you have written in the code.

for example:

 smart

It shows the above tool tip if the required namespace declaration miss in your code file. No need to write the namespace at the top just press the

Ctrl + . smart tag appears as follows

smart2

It automatically inserts the using statement in the using declarations section.

If the method is not defined in your code it generates the method for you

smart3

  • Expand/Shrink Selection To select the statement in your code  you can use CTRL + ALT, = which allows you to select the logical blocks in your code and CTRL + ALT, –  to unselect the block of code.

 

  • Organizing Using’s You may want to sort the using statements in your code file or you may want to remove the unused using statements. you can do as follows in the IDE

usings

  • Camel Case Navigation we all know that we can use arrow keys to move around the code in our file and we can hold the Ctrl key to move around the words and we can use Ctrl + Shift to select the words. Coderush comes with new shortcut Alt+Left and Alt+Right to move around the camel cases in code.

 

  • Anonymous Type  In order to expose anonymous code in public APIs we need to write some type casts. coderush comes with nameanonymous type it creates a new class.

      anonymous

  • Extract Method you can select the code and click on extract method in smart window and shows the preview as shown in the window

ExtractMethod

Here I am summarizing what we have learnt in this post

review

Leave a Reply

avatar
  Subscribe  
Notify of