0

I have an interface definition in C#. Is there any tool to auto-create (generate) all the empty methods of that interface with a default return type? For example i already have:

interface ISampleInterface
{
    void SampleMethod();
    int func(int);
}

and i want:

// auto interface member implementation:
class ImplementationClass : ISampleInterface
{

    void ISampleInterface.SampleMethod()
    {

        return;
    }

    // changed return type to int according to interface definintion
    int ISampleInterface.func(int a)
    {

        return a;
    }

}
toATwork
  • 1,335
  • 16
  • 34
zeus2
  • 309
  • 2
  • 11

2 Answers2

0

Just right click on your class ImplementationClass : ISampleInterface and click on Implement Interface

or else you may consider to use Re-sharper tool

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
0

Here's how you can (standard) implement all the interfaces using ReSharper

https://www.jetbrains.com/resharper/webhelp50/Code_Generation__Implementing_Overriding_Methods.html

csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63