When should one choose IQueryable or IEnumerable?
Leonardo Aguiar
Posted on March 11, 2019
First of all: I am sorry for the lack of references in this discussion, I should have saved the links I went through.
Browsing over the WWW I found some interesting articles about those interfaces, and this subject got my atention because I realised that as a low experienced developer I tend to use only IEnumerable. But after reading through, first it seemed like only IQueryable should be used when querying on external sources of data, which makes sense as the Interface applies filters directly on the source instead of bringing all data to memory.
But then, I found this article that said IQueryable should not be used because it would break test-ability and a few other reasons. This got me lost in between both of the interfaces, not knowing which and when to use one them, of course I will research in more depth, but first I would like to hear this lovely community opnion.
So my fellow Dotnet fans, what are your thoughts on this?
Posted on March 11, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.