IEnumerable vs. IList

"How to Use" IEnumerable and IList [IEnumerable vs. IList]

When you should use IEnumerable and when IList?

You should use IList when you need access by index to your collections and also when you need Add, delete, modify, ordering and / or positioning of your elements in the collections etc.

You should use IEnumerable when you need to enumerate over your collection and represents a forward only cursor and also for querying data from in memory collections like Array, List, and collations etc.

Stayed Informed - IEnumerable vs. IQueryable

Actually, IList interface implements both the interfaces ICollection and IEnumerable and this interface allows us to add, remove, modify and ordering or positioning to items in the collections.

The IList interface has more power than the preceding two interfaces ICollection and IEnumerable.
The IList Interface contains as,
1.      Indexer
2.      Indexof Method
3.      Add Method
4.      Remove Method
5.      RemoveAt Method
6.      Clear Method
7.      Contains Method
8.      Insert Method
9.      IsFixedSize Property
10.  IsReadOnly Property

Stayed Informed - IEnumerable vs. IQueryable

I hope you are enjoying with this post! Please share with you friends. Thank you!!!

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Google Amazon and Flipkart Book Store!

You Might Also Like
Post a Comment Powered by Blogger.
ASK Questions
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book