In , you have regular structs and (fairly obscure) ref structs.

Guess which one can involve a reference (i.e., be allocated on the heap rather than the stack)?

No, that would make sense. This is C#.

"Adding the ref modifier to a struct's declaration ensures that it can only ever reside on the stack." -C# 10 in a Nutshell

Follow

@peterdrake I've heard of structs being passed as ref, but I've never heard of anyone defining them as ref. That's just crazy.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.