Skip to content

ExpandoObject

Question

Describe ExpandoObject.

Short interview answer

ExpandoObject is a dynamic object whose members can be added and removed at runtime. It is useful for flexible object shapes, but gives up compile-time guarantees.

Detailed answer

An ExpandoObject can be accessed through dynamic or as a dictionary of member names and values. It fits integrations or data whose schema is genuinely open-ended. Prefer a defined class or record when the shape is known, because static types give refactoring support, validation, and clearer contracts.

Sources