Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why IEnumerable
Message
From
09/11/2010 17:41:03
 
 
To
09/11/2010 15:07:16
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01488625
Message ID:
01488662
Views:
46
>>Hi,
>>Digging through some code I came to this code definition for the EF ObjectSet class:
public class ObjectSet<TEntity> : ObjectQuery<TEntity>, IObjectSet<TEntity>, IQueryable<TEntity>, IEnumerable<TEntity>, IQueryable, IEnumerable where TEntity : class {}
Since IQueryable implements IEnumerable I don't see why the latter is explicitly listed. Is it just superflous or am I missing some subtlety ?
>
>
>I haven't got vs2010 installed yet - so some thoughts
>
>
>(1) IEnumerable< >
>
>maybe because it implements that interface directly - have a look at the code
>
>(2) IQueryable< >
>
>I think - that IQueryable implements an interface that queries a 'datasource'. I suspect the IEnumerable of IQueryable will work on the result set that has been queried
>
>So, it you use IEnumerable on an ObjectSet, you'll be using the IEnumerable of the ObjectSet
>If you use the ObjectSet with LinQ using a where clause (or maybe things like .Take(n) ), you'll be using the IEnumerable of IQueryable

You lost me. Forget the generics. I'm just looking at the straight 'IQueryable' and 'IEnumerable' interfaces
AFAICS since the class is defined as implementing IQueryable it can, by extension, be cast to IEnumerable. So I'm looking for an example of usage that would not work if the IEnumerable implementation was not explicitly specified....
Previous
Reply
Map
View

Click here to load this message in the networking platform