The concept of an interface is an important element in object-oriented programming. It's what makes OOP so structured but flexible at the same time. In this article James shows us what an interface is and also shows us how to implement some pre-defined interfaces using C#.
Interface, IEnumerable and IEnumerator in C# (Page 1 of 4 )
The concept of an interface is an important element in object-oriented programming. It's what makes OOP so structured but flexible at the same time. By creating interfaces and implementing interfaces, your applications become more reusable and open. Here, when I say open, I mean that it opens opportunities for developers to create applications that can work with other applications that arenít their own.
In this article we're going to examine interfaces in general, as well as C#'s IEnumerable and IEnumerator interfaces. By the end of this article you should have a fairly good idea of what an interface is, and you should also be able to comfortably implement your own interfaces into your C# applications.
I will assume that you're at an intermediate level with C#, and that you are also familiar with OOP and many of its buzzwords, such as polymorphism, inheritance, class and object.