Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

Tips to Save Time in Typing Repetitive Code in Visual Studio 2010 IDE

3.14/5 (7 votes)
12 Sep 2013CPOL1 min read 13.9K  
Tips to save time in typing repetitive code in Visual Studio 2010 IDE

Introduction

Given below are some tips to save time in typing repetitive code in Visual Studio 2010 IDE.

Using the Code

  1. Use code snippets

    For example: prop is an expansion snippet; to use it type “prop”.

    Image 1

    Press Tab, Tab:

    Image 2

    Different code snippets in VS2010 are as follows:

    • try -> for exception handling block
    • tryf -> for exception handling block with finally block
    • for -> for loop block
    • foreach -> foreach loop block
    • svm -> static void Main block
    • ctor -> constructor block
    • testc -> test case block

    For example: region is a Surrounds With code snippet; to use it type “region”.

    Select the class or method to be surrounded with Region code snippet.

    Image 3

  2. Code rush to create code blocks

    Enum can be used create switch cases

    Switch is an expansion code snippet to create switch-case block, then type name of the enum in the square braces and press Shift + Down Arrow key to get the cases for switch case.

    Image 4
  3. Search any file directly from Find combo box.

    Type “>Open <<file>>” in find combo box to get the file directly.

    Image 5
  4. Add namespaces in using block.

    For example: Type “ObservableCollection<project>” and click “Ctrl+.” key combination to add namespaces in the using block.

    Image 6

License

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