Home > Refactorings, Upcoming > Refactorings for graphics – Convert to Size

Refactorings for graphics – Convert to Size

March 23rd, 2012

The Convert to Size refactoring from DevExpress Refactor! Pro consolidates selected numeric parameters into a System.Drawing.Size (System.Windows.Size in WPF projects) or SizeF object. It might be useful to combine two parameters into a single parameter, reducing the overall number of method parameters and increasing code readability.

The refactoring is available when two parameters are called ‘width’ and ‘height’, or parameter names end with the ‘width’ and ‘height’, for example:

Refactor! Convert to Size preview

All calling sides are updated correspondingly when the refactoring is performed:

Refactor! Convert to Size references replacing preview

The opposite of the Convert to Size refactoring is the Decompose Parameter refactoring.

—–
Products: Refactor Pro
Versions: 12.1 and up
VS IDEs: 2008 and up
Updated: Mar/24/2012
ID: U007

Similar Posts: