3 ms·
Interfaces don’t always have boxing penalty. Write generic code, use the interface as generic type constraint, and the interface will work without virtual calls
by Const-me 6y ago
Interfaces don’t always have boxing penalty. Write generic code, use the interface as generic type constraint, and the interface will work without virtual calls, boxing, or any other runtime overhead.
Example of that approach: https://github.com/Const-me/Vrmac/blob/1.2/Vrmac/Draw/Main/ImmediateContext.upload.cs#L86-L137 https://github.com/Const-me/Vrmac/blob/1.2/Vrmac/Draw/Main/I...