Knowing the difference between IEnumerable and IQueryable

OK, so hands up who knows the difference? Hmm, just as I thought, not many. Don’t worry about it, nor did I until just now!

Rather than rambling on (as usual), I’ll just point you at a StackOverflow question where this was answered as clearly as this is likely to be answered anywhere!

http://stackoverflow.com/questions/2876616/returning-ienumerablet-vs-iqueryablet

By the way, if you just query your EF context and don’t explicitly convert your results, you’ll end up with an IQueryable<T>. If you use .AsEnumerable(), you’ll end up with an IEnumerable<T> (surprisingly enough).

Be First to Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.