To declare an interface, you use the
interface keyword rather than
struct. In the interface body, zero or more members can be specified, without any implementation provided. For example:
All this says is that a type implementing this interface promises to support the disposal operation by providing an implementation for the
Contracts or Not?
Where some people disagree with the idea of interfaces as contracts is that they do not really specify a “complete contract” beyond a series of signatures that are merely a syntactic concern. For example, what’s a type supporting
IDisposable supposed to do if ...