Skip to main content

Common Code Blocks

You can create loops, conditional statements, try blocks etc. in seconds with CodeRush Classic templates listed in this topic.

Note

Only the main templates are listed below. Use CodeRush Classic tool window or the Templates options page to access all CodeRush Classic templates.

#Flow Templates

Template Expansion
b Code block
br break keyword
ca case block
co continue keyword
do do/while loop
fe foreach loop
for for loop
sw switch block
tn throw and new keywords
tne throw new Exception() statement
wh while block
yb yield break statement
yr yield return statement

#If/Else Templates

Template Expansion
cod Assigns a new instance of the appropriate type to an identifier from the clipboard if it’s value is null.
if if statement
ifb if block
lb else block
lf else if statement
ll else keyword
lr Smart Return in the else block
lr” return “” in the else block
lrf return false in the else block
lrn return null in the else block
lrt return true in the else block

#Try Templates

Template Expansion
tc try/catch block
tcf try/catch/finally block
tf try/finally block
See Also