Ian Vink
Ian Vink

Reputation: 68750

Resharper: Pull Members Up from base class?

Using Resharper 7.1, C#

I have a class Apple that is based on Fruit

public partial class Apple: Fruit, IEat

Using the command Refactor/Pull Members Up, how do I add the Fruit.Eat() method to the Interface?

The Resharper UI only lets me add Apple members.

Upvotes: 0

Views: 483

Answers (1)

jwg
jwg

Reputation: 5837

The code above (where Apple inherits from both Fruit and IEat) is redundant. I think how you want it is that Apple inherits from Fruit

public class Apple : Fruit

and Fruit inherits from IEat

public class Fruit : IEat

If Fruit inherits from IEat as I have suggested here, then you should be able to do the Resharper "pull members up" from the Fruit class.

If Fruit doesn't inherit from IEat, you can't do the refactoring.

Upvotes: 0

Related Questions