Converting methods into extension methods based on its parameters
The Make Extension refactoring converts the chosen public method into an extension method based on the selected parameter type. To apply the refactoring, select the parameter for which you want to create an extension method:
The resulting method will be placed into the Extensions class. If the Extensions class does not exist, it will be created for you automatically.
Extension methods are created as static methods but are called by using instance method syntax. All references to the original method will be changed automatically once the refactoring is applied. You can immediately rename the method via created linked identifiers:
The refactoring is useful when you want to convert a utility method into an extension method for existing data types. This permits new methods to be created for classes for which you have no access to the source code, including the standard types in the .NET framework libraries or those in third-party assemblies.
—– Products: CodeRush Pro Versions: 12.1 and up VS IDEs: 2008 and up Updated: Jul/23/2012 ID: R058