Bird
0
0

Which LINQ method syntax is used to filter a list to only include elements greater than 10?

easy🧠 Conceptual Q2 of 15
C Sharp (C#) - LINQ Fundamentals
Which LINQ method syntax is used to filter a list to only include elements greater than 10?
Alist.Select(x => x > 10)
Blist.Where(x => x > 10)
Clist.OrderBy(x => x > 10)
Dlist.GroupBy(x => x > 10)
Step-by-Step Solution
Solution:
  1. Step 1: Identify filtering method

    The Where method filters elements based on a condition.
  2. Step 2: Check other methods

    Select transforms, OrderBy sorts, and GroupBy groups elements, none filter by condition.
  3. Final Answer:

    list.Where(x => x > 10) -> Option B
  4. Quick Check:

    Where method = Filter elements [OK]
Quick Trick: Use Where for filtering, Select for transforming [OK]
Common Mistakes:
MISTAKES
  • Using Select instead of Where
  • Using OrderBy to filter
  • Confusing GroupBy with filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes