Does Visual Studio 2010 support something like Eclipse's "Generate Delegate Methods"?

Eclipse allows us to define a class as:

interface MyInterface {
    void methodA();
    int methodB();
}

class A : MyInterface {
    MyInterface myInterface;
}

and then using this “Generate Delegate Methods”, he implements all the necessary methods for the interface, redirecting his logic to the myInterface methods:

class A : MyInterface {
    MyInterface myInterface;

    public void methodA() {
        myInterface.methodA();
    }

    public int methodB() {
        return myInterface.methodB();
    }
}

Is it possible to do the same with VS2010? And with R #?

thank

+3
source share
1 answer

With Resharper you can do this.

http://www.jetbrains.com/resharper/features/code_generation.html

Creation of delegation members

- . , ReSharper .

, . , , , ALT-INS, Generate. - Delegating members. , (), , /, . .

+5

Source: https://habr.com/ru/post/1742028/


All Articles