C
C#2y ago
joki

❔ A question about struct - interface implementation

Structs that implement interfaces arent allocated on the heap normally, rather just if being cast to the specific interface? I'm posting this because im not 100% sure about it
4 Replies
TheBoxyBear
TheBoxyBear2y ago
Structs with interface are allocated the same way as regular structs. It's only when referencing them through the interface they are boxed and treated like objects
joki
joki2y ago
Yeah thats what I thought, thanks
TheBoxyBear
TheBoxyBear2y ago
That also means added limitations such as not being able to use structs in generic covariance
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.