Anonymous Types vs. dynamic
Question
Explain the difference between anonymous and
dynamictypes.
Short interview answer
An anonymous type has a compiler-generated, fixed shape checked at compile time.
dynamicdefers member binding to runtime and may fail only when an operation executes.
Detailed answer
Anonymous types are useful for local projections, such as a LINQ select new { Name, Total }. The compiler knows their members within the scope where the inferred type is available. dynamic is for runtime-discovered members and should be limited to interoperability or truly dynamic data.