Implement Interface

IntelliSense provides an option to help you implement an interface (C# Reference) while working in the Code Editor.

Remarks

Normally, to implement an interface properly you must create a method declaration for every member of the interface in your class. Using IntelliSense, after you type the name of an interface in a class declaration, a smart tag is displayed.

The smart tag gives you the option to implement the interface automatically, using explicit or implicit naming. Under explicit naming, the method declarations carry the name of the interface; under implicit naming, the method declarations do not indicate the interface to which they belong. An explicitly named interface method can only be accessed through an interface instance, and not through a class instance. For more information, see Explicit Interface Implementation (C# Programming Guide).

Implement Interface will generate the minimum number of method stubs that is required to satisfy the interface. If a base class implements parts of the interface, then those stubs are not regenerated.

The Implement Interface option is available automatically when you add an interface declaration to a class. For more information, see How to: Implement Interface

See Also

Other Resources

Automatic Code Generation