Corrected Code on Counting how many fruits are red (#32722)
Corrected the expression that was used on Where clause.
This commit is contained in:
committed by
Randell Dawson
parent
12d4cc83ab
commit
39990df1f3
@ -29,7 +29,7 @@ Then we can do things like:
|
|||||||
var firstName = fruits.Select(f => f.Name).First(); // Orange
|
var firstName = fruits.Select(f => f.Name).First(); // Orange
|
||||||
|
|
||||||
// Count how many fruits are red
|
// Count how many fruits are red
|
||||||
var qntRed = fruits.Where(Color == "Red").Count(); // 2
|
var qntRed = fruits.Where(f => f.Color == "Red").Count(); // 2
|
||||||
|
|
||||||
// Create a list of yellow fruits
|
// Create a list of yellow fruits
|
||||||
var yellowFruits = fruits.Where(f => f.Color == "Yellow").ToList(); // { Pineapple, Mango }
|
var yellowFruits = fruits.Where(f => f.Color == "Yellow").ToList(); // { Pineapple, Mango }
|
||||||
|
Reference in New Issue
Block a user