I am looking for a really simple explanation of interfaces in C#. I have been asking google but the answers I get are very technical and worded in a way a programmer might understand. It almost sounds like a method that can be called in order to perform a function, It allows the programmer to use less key strokes.
From what I am reading below interfaces are a way to create a container of method that do the same thing but with different technologies.
I would like to know what they are? What they do? What I might use them for?
Imagine that you have a pizza store (I’m stealing this example from a famous Design Patterns book). You know that all pizzas need to be ordered, prepared, baked and boxed. Well, you can define this common behavior into an interface:
And have your different kinds of pizzas implement that interface. When you implement an interface, you’re forcing that class to have the same methods and parameters as the interface, for example:
You would pretty much have the same with Hawaiian, Cheese or any other Pizza.
In real life there are several uses for Interfaces. You can create contracts to extend an application, or ensure that it works on different situations.
Hope this helps