Posts Tagged ‘Statements’

Refactorings to execute statements asynchronously

September 17th, 2012 2 comments

In continuing with the ‘Refactorings for simplifying of the .NET 4.0 parallel computing development‘ thread, let’s review the additional refactoring for executing statements asynchronously called in the same manner – Execute Statement Asynchronously. The refactoring is available in two versions:

  • Execute Statement Asynchronously (FromAsync)
  • Execute Statement Asynchronously (StartNew)

Read more…

Adding and removing block delimiters in C#/C++ and JavaScript

March 12th, 2012 3 comments

In C#, C++ and JavaScript languages, curly braces are used as block delimiters. A block allows multiple statements to be written inside. If a block contains a single statement, block delimiters, in most cases, are optional. For example, a single statement inside a loop does not require block delimiters:

CodeRush Optional block delimiters sample

Read more…

Code Issues for Switch (Select) and Case statements

December 14th, 2011 Comments off

A switch statement executes logic, dependent on the value of a given expression (parameter). The types of values a switch statement operates on can be boolean, enum, integral types, and strings. Each switch statement can contain any number of case statements, but no two case constants within the same switch statement can have the same value. Each case statement defines a value to compare against the original expression. You may also include a default label following all other case statements. If none of the other choices match, then the default choice is taken and its statements are executed. If there is no default label, control is transferred outside the switch.

Read more…

Code Issues – Redundant else statement

March 19th, 2011 Comments off


The else statement is redundant when it doesn’t contain any code, and can be safely removed to improve readability. The type of code issue is a dead code.


CodeRush Redundant 'else' statement

How to fix:

CodeRush Redundant Else Statement Fix

Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: any
Updated: Nov/12/2012
ID: C084