I dont know anything about Ienumerable object.what is the role of Ienumarble interface in .net ? Please tell me whether it is in built? Is every class in .net automatically implements the Ienumarable interface ? why there is need to implement the ienumerable interface? what are the methods it contains & what roles they plays. Please explain in detail.
I dont know anything about Ienumerable object.what is the role of Ienumarble interface in
Share
In a nutshell, IEnumerable exposes an enumerator, which allows support of a simple iteration over a non-generic collection.
It basically allows foreach loops over a collection, i.e.:
The only method you need implement to use IEnumable in your own class is
GetEnumerator()which returnsIEnumerator.The IEnumerator you return must be a class that implements the following methods:
A basic example of an IEnumerator class, taken from here: