resharperresharper-8.0

Is it possible to create an extension method using ReSharper?


I would like to Alt+Enter on the Update method below (it doesn't exist) to create a new extension method. Is there a way to do this in ReSharper?

List<FootyTeam> existingTeams = GetFootyTeams();
List<XmlTeam> newTeams = GetXmlTeams();

existingTeams.Update(xmlTeams);

(note, I'm new to ReSharper)


Solution

  • I'm affraid this isn't possible at the moment ( even up to 9.1.3 ). There's the Static Method to Extension Method conversion, but not the refactoring you want.

    Convert Static to Extension Method

    This new refactoring converts a static method to an extension method. For the conversion to be carried out successfully, the static method must (1) have at least one argument and (2) reside in a static class. The reverse functionality is available with 'Convert Extension Method to Plain Static'.

    Source: https://www.jetbrains.com/resharper/features/code_refactoring.html