Archive

Archive for the ‘Refactor’ Category

Refactorings specific to auto-implemented properties

July 12th, 2011 Comments off

Auto-implemented properties enable you to quickly specify a property without having to write logic for the property accessors. The auto-property’s logic and the field serving as a backing store are automatically generated by the compiler. Such properties appeared in C# version 3.0 and Visual Basic version 10.0.

Read more…

Refactorings – Use Implicit Line Continuation

June 30th, 2011 Comments off

The Use Implicit Line Continuation is a Visual Basic language specific refactoring available in Visual Studio 2010 that removes redundant line-continuation underscore characters from an entire source file.

Visual Basic language version 10 has been improved in the area of line-continuation characters. Now, there are a lot of places in the code where an underscore is not necessary anymore, which means that Visual Basic is smarter about auto-detecting line continuation scenarios, and as a result, no longer expect you to explicitly indicate that the statement continues on the next code line. For example, the underscore is no longer necessary in the following cases:

Read more…

Refactorings – Convert to Point

June 28th, 2011 Comments off

The Convert to Point refactoring is based on the Introduce Parameter Object refactoring with the difference that it doesn’t create a new object for parameters. Instead, it uses a ‘Point’ structure when there is a pair of two numeric parameters of a method definition are selected.

Read more…

Refactorings – Use Named Arguments

June 28th, 2011 Comments off

Named Arguments is a feature of the C# and Visual Basic languages introduced in the .NET Framework version 4.0. Named arguments allow you to explicitly specify a name for an argument for a particular parameter by associating the argument with the parameter’s name, rather than with the parameter’s position in the parameter list. Using named arguments frees you from the need to remember or to look up the order of parameters in the parameter lists of called methods.

Read more…

Refactoring ternary expressions into null-coalescing operations and vice versa

May 25th, 2011 Comments off

There are two interesting refactorings shipped in Refactor! Pro:

  • Compress to Null Coalescing Operation
  • Expand Null Coalescing Operation

The first one converts a ternary expression into an equivalent null coalescing operation. The second one is the opposite of the first one – it converts a null coalescing operation to an equivalent ternary expression. Both refactorings are available in CSharp only, because Visual Basic, for example, doesn’t have a null coalescing operator.

Read more…

Changing Signatures Refactorings – Convert to Tuple

May 19th, 2011 Comments off

The Convert to Tuple refactoring shipped in Refactor! Pro is similar to the Introduce Parameter Object refactoring, but it doesn’t create a new object – it uses the built-in .NET Framework 4.0 Tuple object.

Read more…

Refactorings for simplifying of .NET 4.0 parallel computing development

May 18th, 2011 Comments off

Many personal computers and workstations have two or four cores that enable multiple threads to be executed simultaneously. .Net Framework ver. 4.0 has been introduced a standardized and simplified way for creating robust, scalable and reliable multi-threaded applications. The parallel programming extension of .NET 4.0 allows the developer to create applications that exploit the power of multi-core and multi-processor computers. The flexible thread APIs of the extension are much simpler to use and more powerful than standard .NET threads.

Read more…

Refactorings – Introduce Alias

April 18th, 2011 Comments off

The Introduce Alias refactoring creates an identifier that serves as an alias for a namespace or type within the active source file. The alias directive can provide much neater and organized code. When several namespaces contain a matching class name, alias can also help to avoid a name conflict (ambiguous reference) without using the fully qualified type names, which improves overall code readability.

Read more…