Pages

Men

rh

4/11/2013

difference between IEnumerable and List in C#



1 IEnumerable is an interface
2List is one specific implementation of IEnumerable. List is a class.

3FOR-EACH loop is the only possible way to iterate through a collection of IEnumerable,
4 List can be iterated using several ways. Like For loop, Foreachloop.

5IEnumerable doesn't allow random access.
    List allows random access using integral index.

In from of  performance point, IEnumerable is much faster than a List.

No comments :

Post a Comment