An interface contains a group of related functionalities that a class or struct can implement. The interface defines a set of strict rules which need to be implemented when any class implements from that interface. The interface defines only the signature.
interface IEquatable<T>
{
bool Equals(T obj);
}
· Interfaces contain no implementation of methods.
· Interfaces can contain methods, properties, events, indexers, or any combination of those four member types.
· An interface can't contain constants, fields, operators, instance constructors, finalizers, or types.
· Interface members are automatically public, and we can't include any access modifiers.
· Members also can't be static.
· To implement an interface member, the corresponding member of the implementing class must be public, non-static, and have the same name and signature as the interface member.
· Interfaces can inherit from other interfaces.
· A class or struct can implement multiple interfaces. A class can inherit a base class and also implement one or more interfaces.
0 Comments