Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's Wrong With this?
Message
De
07/06/2010 15:50:41
 
 
À
07/06/2010 14:34:15
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01467696
Message ID:
01467732
Vues:
47
>>>That did it. Thanks!
>>
>>What's the difference? Or lucky guess?
>
>where is how you get records limited by some condition. Using select without a where is fruitless unless you want everything in the collection. In his case, he was selecting 1 record, the select condition was ignored I think in that select is generally used to select individual fields from thh collection. However, using the where, limits the query only to records that apply to the condition.

The output from the Select would be an enumerable collection of bool values. Since there was only one entry in the Dictionary then Count() would return 1. This might make the mistake clearer:
 Dictionary<int, bool> lRuleCheck = new Dictionary<int, bool>();
lRuleCheck.Add(1, true);
lRuleCheck.Add(2, true);
lRuleCheck.Add(3, false);

var x = lRuleCheck.Select(x => x.Value);
- returns three boolean values - so in this case Count() would be 3 regardless.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform