- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Interface Types
Interfaces define properties, methods, and events, which are the members of the interface.Interfaces contain only the declaration of the members.
Some of the interface types in C# include.
IEnumerable − Base interface for all generic collections.
IList − A generic interface implemented by the arrays and the list type.
IDictionary − A dictionary collection.
IEnumerable is an interface defining a single method GetEnumerator that returns an IEnumerator interface.
This works for readonly access to a collection that implements that IEnumerable can be used with a foreach statement.
The following shows the implementation of IEnumerable interface.
Example
class Demo : IEnumerable, IEnumerator { // IEnumerable method GetEnumerator() IEnumerator IEnumerable.GetEnumerator() { throw new NotImplementedException(); } public object Current { get { throw new NotImplementedException(); } } // IEnumertor method public bool MoveNext() { throw new NotImplementedException(); } // IEnumertor method public void Reset() { throw new NotImplementedException(); } }
Above you can see the two methods of IEnumerator.
// IEnumerator method public bool MoveNext() { throw new NotImplementedException(); } // IEnumertor method public void Reset() { throw new NotImplementedException(); }
- Related Articles
- What is Interface Testing(Types & Example)?
- Types of Application Programming Interface (API) and their Security vulnerabilities.
- Interface in C#
- Queue Interface In C#
- SortedMap Interface in C#
- What is an interface in C#?
- What are the data types, value types and reference types in C#?
- How do you declare an interface in C++?
- Difference between Abstract Class and Interface in C#
- Difference between IComparable and IComparer Interface in C#
- Difference between IEnumerator and IEnumerable Interface in C#
- How to declare member function in C# interface?
- What does the interface ICollection do in C#
- What does the interface IEnumerable do in C#?
- What does the interface IList do in C#?

Advertisements