Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why IEnumerable
Message
De
09/11/2010 15:07:16
 
 
À
09/11/2010 13:10:01
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 4.0
Divers
Thread ID:
01488625
Message ID:
01488645
Vues:
58
>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
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform