是否可以使用 ReSharper 创建扩展方法?
Is it possible to create an extension method using ReSharper?
我想 Alt+Enter 在下面的更新方法(它不存在)上创建一个新的扩展方法.有没有办法在 ReSharper 中执行此操作?
List<FootyTeam> existingTeams = GetFootyTeams();
List<XmlTeam> newTeams = GetXmlTeams();
existingTeams.Update(xmlTeams);
(注意,我是 ReSharper 的新手)
我担心目前这是不可能的(即使是 9.1.3)。有静态方法到扩展方法的转换,但不是您想要的重构。
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'.
来源:https://www.jetbrains.com/resharper/features/code_refactoring.html
我想 Alt+Enter 在下面的更新方法(它不存在)上创建一个新的扩展方法.有没有办法在 ReSharper 中执行此操作?
List<FootyTeam> existingTeams = GetFootyTeams();
List<XmlTeam> newTeams = GetXmlTeams();
existingTeams.Update(xmlTeams);
(注意,我是 ReSharper 的新手)
我担心目前这是不可能的(即使是 9.1.3)。有静态方法到扩展方法的转换,但不是您想要的重构。
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'.
来源:https://www.jetbrains.com/resharper/features/code_refactoring.html