Definition - What does Interface mean?
In general, an interface is used to describe a set of related functionalities that can be implemented in a class or struct. It enables a class to inherit multiple behaviors defined in multiple interfaces. It also helps to resolve the name ambiguity that arises while using multiple methods with same names existing in different interfaces.
Designing applications using interfaces helps to address the vital requirements of flexible systems such as loose coupling, separation of concerns and adaptability to future changes. Due to the isolation of components that implement the interfaces of an application, testing these components becomes easier. The .NET Framework library uses many generic interfaces (whose types are parameterized) in collection classes to represent items in a collection so that the boxing and unboxing operations on value types are avoided.
Techopedia explains Interface
For example, IDisposabe is an interface that can be implemented by a C# class to clean up the resources used by the objects of that class type.
The key features of an interface include:
- It can be declared within a name space or a class.
- Its members can be a method, property, event or indexer, but cannot be a constant, field, operator, instance constructor, destructor, type or static member.
- It cannot be instantiated as an object and cannot be defined with data members.
- Unlike a class that can inherit only one base class and multiple interfaces, an interface can inherit multiple interfaces only.
- An interface member has public access by default, which cannot be modified using any access modifiers.
- Modifiers, such as virtual, override or static, should not be used with an interface member.
- An interface can be accessed using its fully qualified name, which includes the interface name followed by a dot and the member name.
- An interface member with the "new" modifier can be used to hide an inherited member with the same name.
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Approaches and Benefits of Network Virtualization:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: