Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to force an update of an Interface?

In resharper is it possible to force an update of an interface?

Basically I have a class that inherits from an interface but this class is constantly changing so I need to reflect the changes in the interface otherwise VS complains that I am not implementing something as the signature of the method has changed.

I was wondering if there is a way in resharper to say "Update this class with its interface" ?

Any ideas?

like image 397
mark smith Avatar asked Oct 08 '09 09:10

mark smith


2 Answers

Although not the best way to design, sometimes it is necessary to update the interface based on the modified class.

You can update the interface using resharper's Pull Members Up option.

  1. Use the Pull Members Up option in the refactor menu
  2. Select the interface you would like to update as the base type
  3. Select the members you would like to add to the interface

The members have now been added to the interface.

like image 79
Myrtle Avatar answered Nov 14 '22 22:11

Myrtle


If you use ReSharper to modify the method, it can/will also modify the interface definition.

For instance, if you use ReSharper's Rename functionality on the method, the interface definition of it will get renamed. Additionally, if you use ReSharper's Change Signature functionality on the method, it asks you if you want to do the refactoring on the interface as well.

like image 44
adrianbanks Avatar answered Nov 14 '22 22:11

adrianbanks