Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract method to already existing interface with ReSharper

I'm adding a new method to a class that implements an interface, and I like to use the "Extract Interface" refactoring and just add the method to the interface. But it doesn't seem like ReSharper supports adding a method signature to an already existing interface.

It feels like I'm missing something, I'm sure it can be done somehow. Maybe I should add the method signature to the interface first, but this is the way I'm working sometimes. Am I missing some shortcut, feature or using ReSharper wrong?

like image 636
Johan Danforth Avatar asked Feb 20 '10 12:02

Johan Danforth


People also ask

What is Extract method refactoring?

The Extract Method refactoring lets you take a code fragment that can be grouped, move it into a separated method, and replace the old code with a call to the method.


1 Answers

Ctrl+Shift+R to access the refactoring menu then choose Pull Members Up...

You can choose the interface that you want to add the declarations to and also select each method that you want to add to the interface.

Gotta love Resharper! ;-)

like image 64
Russell Giddings Avatar answered Sep 21 '22 19:09

Russell Giddings