Let\'s say I need an extension method which selects only required properties from different sources. The source could be the database or in-memory collection. So I have defined
If your code only actually works when the objects its dealing with are loaded in memory, just supply the IEnumerable
variant and let your callers decide when they want to convert an IQueryable
into an in-memory IEnumerable
.
Generally, you won't implement new variations around IQueryable
unless you're writing a new database provider.