Where()
Where() filters records based on a condition.
Syntax
collection.Where(x => condition);
Example
var result = employees
.Where(x => x.Salary > 50000);
Output
Returns only matching records.
Interview Tips
Where() returns IEnumerable.
Where() filters records based on a condition.
collection.Where(x => condition);
var result = employees
.Where(x => x.Salary > 50000);
Returns only matching records.
Where() returns IEnumerable.