Is it possible to force an update of the interface?

Can resharper force an interface upgrade?

Basically, I have a class that inherits from the 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, because the method signature has changed.

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

Any ideas?

+4
source share
4 answers

Allowing an interface to follow an implementation is an exact wrong direction. First, you must define in your interface what you need, and then implement it in the support class. You should not expect the tool to support unwanted workflows ...

If you drive correctly, R # will give you all the support you need: you can reorganize existing methods with Refactor | Rename ..., Refactor | Change Signature ... and Implement Members.

-5
source

Although this is not the best way to develop, it is sometimes necessary to update an interface based on a modified class.

You can update the interface using the resharper Pull Members Up parameter.

  • Use the Pull Members Up option in the refactoring menu.
  • Select the interface you want to update as the base type
  • Select the participants you want to add to the interface

Members are now added to the interface.

+20
source

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

For example, if you use the ReSharper Rename method functionality, the interface definition will be renamed. In addition, if you use the ReSharper Change Signature function in a method, it will ask you if you also want to refactor the interface.

+2
source

If you change the signature of a method defined in an interface, change it using Refactor - Change Signature .... ReSharper will ask you if you want to change the signature of the interface method.

In addition, I cannot imagine how ReShaper knew what and how to update.

0
source

All Articles