3 ms·
I'm not trying to. It's just a shallow type hierarchy. And I can achieve it with Interface. But I would prefer a solution that doesn't box.
by Ygg2 6y ago
I'm not trying to. It's just a shallow type hierarchy. And I can achieve it with Interface. But I would prefer a solution that doesn't box.
- dfgdghdf 6y agoInterfaces don't have a compile-time size so I don't see how you can use avoid boxing if you want a collection of IFoo. (Optimized) discriminated unions have a size that is the max size of the possible types, plus a flag to indicate the type. This is the best you can hope for without boxing.