Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's Wrong With this?
Message
From
07/06/2010 15:50:41
 
 
To
07/06/2010 14:34:15
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01467696
Message ID:
01467732
Views:
48
>>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform