Monday, July 28, 2014

What is the difference between IEnumerable and IEnumerator? ASP.Net

IEnumerable is an interface for all non-generic collections that can be enumerated. IEnumerable contains a single method, GetEnumerator, which returns an IEnumerator.

Syntax:
public interface IEnumerable
{
IEnumerator GetEnumerator();
}


IEnumerator provides the ability to iterate through the collection by exposing a Current property and MoveNext and Reset methods. Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.

Syntax:
public interface IEnumerator
{
object Current { get; }
bool MoveNext();
void Reset();
}


No comments:

Post a Comment

React-select is very slow on larger list - Found solution - using react-window

 I had more than 4000 items in searchable dropdownlist. I have used react-select but it was very slow. finally I found complete solution to ...