Boydski Boydski - 1 year ago 90
C# Question

Is there a way to create anonymous structs in C#?

There doesn't seem to be any way as anonymous types derive from object. But I thought I'd ask since much of the time we use anonymous types in simple query expressions to extract subsets of data to be used in those anonymous types we create. It just seems to me they should be structs (value types) for greater memory efficiency vs. reference types.


Answer Source

No there is no supported C# syntax which will produce anonymous structs

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download