Refactorings – Convert to Point

June 28th, 2011

The Convert to Pointrefactoring 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.

Depending on the project type and numeric parameter types, the Convert to Point may use one of the following Point structures:

System.Drawing.Point

System.Drawing.PointF

System.Windows.Point (in WPF)

Note however, if the project doesn’t reference the assemblies for the Point structure (e.g. System.Drawing.dll) the refactoring won’t be available.

The Convert to Point can be useful when you work with graphics and appropriate graphic objects, for example: