Understanding IEnumerable and IQueryable in C#

Read full article at Falafel blog

I see developers are not that confident about usage of the mentioned interfaces. In this post, I am going to discuss basic differences among IEnumerable<T> and IQueryable<T> and in which scenario to use what.

IEnumerable<T>

The IEnumerable<T> is used to iterate a read only collection. It has only one method GetEnumeartor() which allows you to iterate the read only collection using a foreach loop. It only iterates in the forward direction. IEnumerable <T> is defined in as follows:

clip_image002

Read full article at Falafel blog

One response to “Understanding IEnumerable and IQueryable in C#”

  1. […] Understanding IEnumerable and IQueryable in C# (Dhananjay Kumar) […]

Leave a comment

Create a website or blog at WordPress.com