开发者

Tool for extracting base class?

If I have a C# code like this:

public class A {
    public string PropA { get; set; }
    public string PropB { get; set; }

    public string PropZ { get; set; }

}

public class B {
    public string PropA { get; set; }
    public string PropB { get; set; }

    public string PropX { get; set; }
    public string PropY { get; set; }

}

As PropA and PropB exist in both class, and have the same meaning, I'd like to refactor like this :

public abstract class Base {
    public string PropA { get; set; }
    public string PropB { get; set; }
}

public class A : Base {
    public string PropZ { get; set; }

}
public class B : Base {

    public string PropX { get; set; }
    public string PropY { get; set; }

}

Using VS 2010, is there any tool/extension that allows me to quickly do that ? In fact, my actual co开发者_StackOverflow社区de contains dozens of property in several classes, not in the same order. This is can be a bit of pain to properly factorize the code... that's why I'm looking for a lazy way to do this


You can use Resharper with "Extract Superclass".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜