Declaring enumeration types and its elements in CodeRush

December 14th, 2011 Comments off

An enumeration type is a special set of related constants, each with an integer value. Enumerations are useful for defining states and sequences, particularly when there is a natural progression through those states. Each constant in the enumeration list can be compared and formatted using either its name or value. For example, assume that you have to define a variable whose value will represent a day of the week. There are only seven meaningful values which that variable will ever store. To define those values, you can use an enumeration type.

Read more…

Refactorings strings in Visual Studio using CodeRush

November 30th, 2011 Comments off

The String data type of .NET Framework is one of the most often used types when developing software. There are a number of basic operators available for use with strings, such as concatenation and equality comparison. Also the data type is based on a class that includes many powerful methods for string manipulation. Let’s take a brief look at what refactorings shipped in DevExpress Refactor! Pro help us deal with the String data type. You can follow each link, to learn more about a specific refactoring.

Read more…

Refactorings that work with strings – Use String.Compare

November 30th, 2011 Comments off

The Use String.Compare refactoring shipped in DevExpress Refactor! Pro allows you to convert a usual string equality comparison (==) into a more flexible Compare call on the System.String class. Consider the following code:

Use String.Compare refactoring sample code

Read more…

DXCore Services – Tool Windows

November 28th, 2011 Comments off

The ToolWindows DXCore service provides methods for DXCore and Visual Studio tool windows manipulation.

Read more…

DXCore Services – Version

November 28th, 2011 Comments off

The Version DXCore service provides DXCore/IDE Tools version information.

Read more…

DXCore Services – Text Views

November 28th, 2011 Comments off

The TextViews DXCore service provides methods and properties for text view manipulation. A text view is a window in Visual Studio IDE that lets you type, edit and view source code text.

Read more…

Refactorings that work with strings – Use Environment.NewLine

November 25th, 2011 Comments off

The Use Environment.NewLine refactoring is one of the simplest refactoring shipped in DevExpress Refactor! Pro which improves code portability. This refactoring replaces the “\r\n” string with the value of the Environment.NewLine property reference. The Environment.NewLine is a static string property from the System namespace that is tied to the current executing environment (platform). It returns a valid “line feed/carriage return” string that corresponds to the current operating system, for example: “\r\n” for Windows platforms, or a string containing just a line feed (“\n“) for Unix platforms.

Read more…

Refactorings that work with strings – Use IsNullOrEmpty

November 25th, 2011 Comments off

When checking that a user has provided a valid input, you will often want to ensure that it is not null or empty. Strings are reference types and can be equal to a null value like any other reference type. Strings can also be empty, meaning their values equal “” and they have zero length. The IsNullOrEmpty call of the System.String class indicates whether the given string is a null or an empty (“”) string. Before this call appeared in the .NET Framework, we were checking strings as follows (for example):

Refactorings - Use IsNullOrEmpty sample code

Read more…