C
C#3y 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
TheBoxyBear3y 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
jokiOP3y ago
Yeah thats what I thought, thanks
TheBoxyBear
TheBoxyBear3y ago
That also means added limitations such as not being able to use structs in generic covariance
Accord
Accord3y 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.
Want results from more Discord servers?
Add your server