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
Once Type.IsEnum is an intrinsic (#71685) and the static Enum.TryFormat has been added (#71590), we should be able to update the in-box interpolated string handlers to special-case enums and use TryFormat rather than calling ToString on them, which at a minimum boxes and worst-case allocates a result string. This can either be a long-term solution, or it can be a stop-gap until Enum itself implements ISpanFormattable, which we've said we'll only do if the JIT is updated to avoid boxing when using its methods.
(We can similarly special-case anywhere optimized formatting would be helpful, e.g. maybe in StringBuilder, in ValueStringBuilder, etc.)
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.
Issue Details
Once Type.IsEnum is an intrinsic (#71685) and the static Enum.TryFormat has been added (#71590), we should be able to update the in-box interpolated string handlers to special-case enums and use TryFormat rather than calling ToString on them, which at a minimum boxes and worst-case allocates a result string. This can either be a long-term solution, or it can be a stop-gap until Enum itself implements ISpanFormattable, which we've said we'll only do if the JIT is updated to avoid boxing when using its methods.
Once Type.IsEnum is an intrinsic (#71685) and the static Enum.TryFormat has been added (#71590), we should be able to update the in-box interpolated string handlers to special-case enums and use TryFormat rather than calling ToString on them, which at a minimum boxes and worst-case allocates a result string. This can either be a long-term solution, or it can be a stop-gap until Enum itself implements ISpanFormattable, which we've said we'll only do if the JIT is updated to avoid boxing when using its methods.
(We can similarly special-case anywhere optimized formatting would be helpful, e.g. maybe in StringBuilder, in ValueStringBuilder, etc.)
The text was updated successfully, but these errors were encountered: