使用 Resharper 7.1,C#
我有一门Apple
基于Fruit
public partial class Apple: Fruit, IEat
使用命令Refactor/Pull Members Up,如何将Fruit.Eat()方法添加到接口?
Resharper UI 只允许我添加Apple
成员。
使用 Resharper 7.1,C#
我有一门Apple
基于Fruit
public partial class Apple: Fruit, IEat
使用命令Refactor/Pull Members Up,如何将Fruit.Eat()方法添加到接口?
Resharper UI 只允许我添加Apple
成员。
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.