How to: Implement an Interface (Class Designer)
In Class Designer, you can implement an interface on the class diagram by connecting it to a class that provides code for the interface methods. Class Designer generates an interface implementation and displays the relationship between the interface and the class as an inheritance relationship. You can implement an interface by drawing an inheritance line between the interface and the class or by dragging the interface from Class View.
Tip
You can create interfaces the same way you create other types. If the interface exists but does not appear on the class diagram, then first display it. For more information, see How to: Create Types by using Class Designer and How to: View Existing Types (Class Designer).
To implement an interface by drawing an inheritance line
On the class diagram, display the interface and the class that will implement the interface.
Draw an inheritance line from the class and the interface.
A lollipop appears attached to the class and a label with the interface name identifies the inheritance relationship. Visual Studio generates stubs for all interface members.
For more information, see How to: Create Inheritance Between Types (Class Designer).
To implement an interface from the Class View window
On the class diagram, display the class that you want to implement the interface.
Open Class View and locate the interface.
Tip
If Class View is not open, open Class View from the View menu. For more information about Class View, see Viewing Classes and Their Members.
Drag the interface node to the class shape on the diagram.
A lollipop appears attached to the class and a label with the interface name identifies the inheritance relationship. Visual Studio generates stubs for all interface members; at this point, the interface is implemented.
See Also
Tasks
How to: Create Types by using Class Designer
How to: View Existing Types (Class Designer)
How to: Create Inheritance Between Types (Class Designer)