What is Interface Concepts in C#
This article will help to developer to increase Interface concept in c#.
Interface- An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface. A class that implements an interface can explicitly implement members of that interface
About Interface-Interface- An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface. A class that implements an interface can explicitly implement members of that interface. An explicitly implemented member cannot be accessed through a class instance, but only through an instance of the interface.
An interface can inherit from one or more base interfaces. When a base type list contains a base class and interfaces, the base class must come first in the list.
Interface Concepts in C# :
1- Interface does not have class in class declaration.
2- Interface can have public access (It's not necessary because interface is by default public) modifier in class declaration.
3- Interface only have method signature not body.
4- We can create method, Event, Properties and indexer in Interface.
5- An interface can inherit from one or more base interfaces.
6- We can't use public access modifier when declare any method, Proper, Event and indexer in Interface.
It throws error: "The modifier 'public' is not valid for this item".
Basically interface is object by which users can communicate to your module/class.