Interface Declaration

An interface is a reference type that contains only abstract members. The members an interface can contain are events, methods, properties, and indexers. However, an interface can contain only the declaration of these members. The implementation of these members must be present in the classes that implement the interface. An interface cannot contain constants, fields, constructors, destructors, or static members. This is because the purpose of an interface is to define a contract and constants, fields, constructors, destructors, and static members do not help in defining a contract. An interface defines a standard, which the implementing class should then follow.

An interface declaration uses the following syntax:

						attributes ...

Get Special Edition Using C# 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.