Interface Members

The definition of an interface is much like a class or struct. However, since an interface doesn't have an implementation, its members are defined differently. The following example shows how to declare an interface, and how an interface is structured.

[modifiers] interface IName [: Interface [, Interfaces]]
{
       // methods
       // properties
       // indexers
       // events
}

The modifiers may be public, protected, protected internal, internal, private, and new. Next is the keyword interface followed by the interface name, IName. A common convention is to make the first character of an interface name the letter I. The name must conform to the C# rules for identifiers. After the name is a colon and a comma-separated list of interfaces that this ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.