Warning code issues for the IDisposable pattern

September 14th, 2012 Comments off

Here are two code issues of the warning type that might be helpful in detecting objects of a class that have not undisposed. Such objects may lead to temporary unmanaged resource leaks.

Read more…

Code provider to format the String.Format call output

September 4th, 2012 Comments off

The String.Format call is the best approach for outputting information for the user to read. It replaces the format items in the specified template string with the string representation of the corresponding objects. The template string contains text that is desired in the final string and one or more format item placeholders, which will be replaced with other values passed as arguments to the String.Format call as either variable references or other literals.

Read more…

Code providers for working in two-dimensional space

September 4th, 2012 Comments off

There are two code providers that are useful when you have written the code to work in one dimension, but if you want to create a similar code to work in a two-dimensional space, here is an example:

Read more…

Code Providers – Reference Assembly

August 30th, 2012 Comments off

The Reference Assembly code provider is a simple coding helper which allows you to add an assembly reference if one does not exist for the type reference under the editor caret. The code provider is connected to the CodeRush Code Issues feature, so the editor caret should be located in the ‘Undeclared element’ code issue, for instance:

CodeRush Reference Assembly sample code

Read more…

Code Providers – Convert to Integer

August 30th, 2012 Comments off

The Convert to Integer code provider allows you to wrap an expression returning a non-integer value to Math.Ceiling, Math.Floor, or Math.Round. Consider the following code sample:

CodeRush Convert to Integer sample code

Read more…

Code providers for converting unimplemented properties

August 30th, 2012 Comments off

CodeRush has two code providers that allow you to convert unimplemented properties into a property with backing store field or into an auto-implemented property quickly:

  • Convert to Property with Backing Store
  • Convert to Auto-implemented Property

Read more…

Refactorings for Loops and Blocks overview

August 28th, 2012 Comments off

This is just a quick overview list to organize a bunch of refactorings that deal with loops and blocks. Click the refactoring name to learn more about it.

Add Block Delimiters

This refactoring embeds a single statement into curly braces.

Consolidate Using Statements

This refactoring combines several neighboring or nested using statements that cover variables of the same type into a single using statement.

Read more…

The Introduce ForEach Action refactoring

August 28th, 2012 1 comment

It is a rather trivial task to iterate over each item of the generic List using a foreach-loop as follows:

ForEach-loop iteration

Read more…