Interfaces

The System namespace defines a number of interfaces. An interface is a set of pure virtual function definitions, which a class can choose to implement. You define an interface to enforce a common design pattern among classes that are not hierarchically related. For example, the IDisposable interface contains the method Dispose, used for deterministic finalization. This provides a way to force an object to perform its cleanup code immediately instead of when the garbage collector feels like getting around to it. Any class anywhere in any inheritance hierarchy might reasonably need this behavior. However, most classes won't need this behavior, so it wouldn't make sense to put it in the System.Object base class and force all objects to ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library 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.