You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really excited to see Shapes/Roles finally being implemented (hopefully in C# 13) via implicit and explicit Extensions. Since it was mentioned several times by the team that the functionality of existing extension methods will be fully available via new implicit extensions, I wanted to know if it applies to generic constraints:
publicimplicitextensionRectangleExtension<TRect>for TRect where TRect : IRectangle<int>{//NOTE: TRect - generic (constrained) type parameter and not a concrete typepublic int Area => ...}
So will syntax like the one above be used, or some other syntax, or such feature will not be supported?
Generic constraints like this are hugely useful for performance reasons, because if structs are involved they will not be boxed due to JIT optimizations. Hopefully with the new extensions this functionality will be preserved.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Really excited to see Shapes/Roles finally being implemented (hopefully in C# 13) via implicit and explicit Extensions. Since it was mentioned several times by the team that the functionality of existing extension methods will be fully available via new implicit extensions, I wanted to know if it applies to generic constraints:
Current C#
Future C#
So will syntax like the one above be used, or some other syntax, or such feature will not be supported?
Generic constraints like this are hugely useful for performance reasons, because if structs are involved they will not be boxed due to JIT optimizations. Hopefully with the new extensions this functionality will be preserved.
Beta Was this translation helpful? Give feedback.
All reactions