DIFFERENCE BETWEEN IENUMERABLE AND LIST IN C#?

Harsh kumar srivastava

Total Post:65

Points:325
C#
 85  View(s)
Ratings:
Rate this:
  1. Harsh kumar srivastava

    Post:65

    Points:325
    Difference between ienumerable and list in c#?

    The difference is that IEnumerable<string> is merely a sequence of string but a List<string> is indexable by an int index, can be added to and removed from and have items inserted at a particular index.

    A List<string> is a specific random-access variable-size collection.

    A List<string> is a concrete implementation of IEnumerable<string>. 

    An IEnumerable<string> is general sequence of string that can be iterated but doesn't allow random access.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!