Search code examples
visual-studio-2008inheritanceinterface

Visual Studio - automatically implement all inherited methods from an interface


Let's say we have a class called MyClass.

public class MyClass

We also have an interface like so:

public interface MyInterface{

public string SomeFunction(int foo, string bar, short baz){}
}

We want this class to inherit from MyInterface.

public class MyClass: MyInterface

MyInterface has n properties, and i methods. How can I get Visual Studio to automatically implement all those methods and properties without the developer doing any of the legwork?


Solution

  • For C#, you can right click the 'MyInterface' and choose 'Implement Interface' from the context menu. I believe there is a similar (but slightly different) shortcut for VB.NET.