Bird
0
0

Why does the select clause in LINQ allow projecting new anonymous types instead of just existing types?

hard🧠 Conceptual Q10 of 15
C Sharp (C#) - LINQ Fundamentals
Why does the select clause in LINQ allow projecting new anonymous types instead of just existing types?
ATo enable creating custom shaped results without defining new classes
BBecause LINQ cannot return existing types
CTo force all queries to return anonymous types
DTo improve query performance by avoiding objects
Step-by-Step Solution
Solution:
  1. Step 1: Understand anonymous types purpose

    Anonymous types let you create custom shaped data on the fly without defining classes.
  2. Step 2: Eliminate incorrect options

    LINQ can return existing types; it does not force anonymous types; performance is not improved by anonymous types.
  3. Final Answer:

    To enable creating custom shaped results without defining new classes -> Option A
  4. Quick Check:

    Anonymous types = flexible custom shapes [OK]
Quick Trick: Anonymous types create custom shapes easily [OK]
Common Mistakes:
MISTAKES
  • Thinking LINQ cannot return existing types
  • Believing anonymous types improve performance
  • Assuming anonymous types are mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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