What’s the difference between IEnumerable and Array?
What’s the difference between IList and List?
These seem to have the same function.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
IEnumerableprovides only minimal "iterable" functionality. You can traverse the sequence, but that’s about it.This has disadvantages; for example, it is very inefficient to count elements using
IEnumerable, or to get the nth element.But it has advantages too; for example, an
IEnumerablecould be an endless sequence, like the sequence of primes.Arrayis a fixed-size collection with random access (i.e. you can index into it).Listis a variable-size collection (i.e. you can add and remove elements) with random access.IListis an interface which abstracts list functionality (count, add, remove, indexer access) away from the various concrete classes such asList,BindingList,ObservableCollection, etc.