What is an interface?

An interface behaves as a contract between itself and any class where it’s used. A class that implements an interface must now implement all its members. These interfaces are usually named with a capital I, though it isn’t required. These interfaces can only contain declarations, and all members are implicitly abstract and public. Beginning with C# version 8.0, however, an interface may define default implementations for some or all of its members.

Example

Get hands-on with 1400+ tech skills courses.