Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's Wrong With this?
Message
De
07/06/2010 14:14:53
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01467696
Message ID:
01467711
Vues:
70
>>>First I'm creating a dictionary like this:
>>>
>>>
>>>Dictionary<int, bool> lRuleCheck = new Dictionary<int, bool> { };
>>>
>>>
>>>The dictionary is being populated with PK's and True/False. Then, I later query it like this:
>>>
>>>
>>>var trueCount = lRuleCheck.Select(x => x.Value == true).Count();
>>>var falseCount = lRuleCheck.Select(x => x.Value == false).Count();
>>>
>>>
>>>At the point this is run, there's only one item in the dictionary, with a 0/true, yet both trueCount and falseCount are both 1.
>>
>>Try:
var trueCount = lRuleCheck.Where(x => x.Value).Count();
>>var falseCount = lRuleCheck.Where(x => !x.Value).Count();
>
>
>That did it. Thanks!

What's the difference? Or lucky guess?
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform