3 ms·
Interfaces 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
by dfgdghdf 6y ago
Interfaces 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.