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






3.14/5 (7 votes)
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
- Use code snippets
For example:
prop
is an expansion snippet; to use it type “prop
”.Press Tab, Tab:
Different code snippets in VS2010 are as follows:
try
-> for exception handling blocktryf
-> for exception handling block with finally blockfor
-> for loop blockforeach
-> foreach loop blocksvm
-> static void Main blockctor
-> constructor blocktestc
-> 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. - Code rush to create code blocks
Enum
can be used createswitch
casesSwitch
is an expansion code snippet to createswitch
-case
block, then type name of theenum
in the square braces and press Shift + Down Arrow key to get the cases forswitch
case. - Search any file directly from Find combo box.
Type “>Open <
>” in find combo box to get the file directly. - Add namespaces in
using
block.For example: Type “
ObservableCollection
” and click “Ctrl+.” key combination to add namespaces in the using
block.