Interface
1. Interface is not a class, it is an entity but it is similar to class that contains abstract methods, properties, indexers and events.
2. Interface has no implementation, it has only definitions.
3. If a class implements an interface, then interface agrees to provide the all features define by the interface and class agrees to implements all features provide by interface.
4. Interface is simply defined by interface keyword.
5. Interface has no implementation it has only the signature. Interface have only abstract method.
6. Interface cannot have access modifier private, protected, protected internal.
7. Interface cannot have data field.
8. The class must implements all features of inherited interface.
9. A class implement more than one interface but only one abstract class inherit.
10. An Interface is not a class, it is an entity that is defined by the keyword interface.
interface IAdd
{

}
Interface has no implementation it has only the signature. All methods inside interface is abstract method.
interface IAdd
{
int Add(int a, int b);
}
By default interface is public. Its support only public and internal access modifiers not private, protected, protected internal.
// Incorrect
private interface IAdd{ }
protected interface IAdd{ }
protected internal interface IAdd{ }

// Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal
Interface can not contains data fields.
// Incorrect
interface IAdd
{
int a;
}
// Interfaces cannot contain fields
If a class implemented an interface, it agree to provide the feature defined by interface. If you not implement then it's throwing error
// Incorrect
// It’s throwing an exception that forcing to implement interface’s method

interface IAdd
{
void Add(int a, int b);
}

class Program : IAdd
{
static void Main(string[] args)
{

}
}
// 'Interface.Program' does not implement interface member 'Interface.IAdd.Add(int, int)
A simple example of Interface IAdd.
// Defining an interface
interface IAdd
{
// Abstract method
void Add(int a, int b);
}

class Program : IAdd
{
static void Main(string[] args)
{
Program pro = new Program();
IAdd objadd = pro;
// Access interface's method
objadd.Add(4, 5);

Console.Read();
}

// Implement interface method ‘IAdd.Add’
public void Add(int x, int y)
{
Console.WriteLine("Interface IAdd.Add method - " + x + y);
}
}

// Output
// Interface IAdd.Add method - 45
Interface can contain properties.
// Defining interface
interface IAdd
{
int first_number { get; set; }
int second_number { get; set; }
void Add(int first_number, int secon_dnumber);
}

class Program : IAdd
{
// Implementing interface's properties
public int first_number { get; set; }
public int secon_dnumber { get; set; }
static void Main(string[] args)
{
Program pro = new Program();
IAdd objadd = pro;

// Access interface's members
objadd.first_number = 5;
objadd.secon_dnumber = 4;
objadd.Add(4, 5);

Console.Read();
}

// Interface IAdd.Add method
public void Add(int x, int y)
{
Console.WriteLine("Interface IAdd.Add method - " + (x + y));
}
}

// Output
// Interface IAdd.Add method - 9
A class can inherit more than one interface.
// Defining first interface
interface IAdd
{
void Add(int a, int b);
}

//Defining second interface
interface IMultiply
{
void Multiply(int a, int b);
}
class Program : IAdd, IMultiply
{
static void Main(string[] args)
{
Program pro = new Program();
IAdd objadd = pro;
//Access interface IAdd's method
objadd.Add(4, 5);

IMultiply objmultiply = pro;
//Access interface IMultiply's method
objmultiply.Multiply(4, 5);
Console.Read();
}
// Interface IAdd.Add method
public void Add(int x, int y)
{
Console.WriteLine("Interface IAdd.Add method - " + (x + y));
}
// Interface IMultiply.Multiply method
public void Multiply(int x, int y)
{
Console.WriteLine("Interface IMultiply.Multiply method - " + (x * y));
}
}