Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite Enum and add {ISpanFormattable}.TryFormat (dotnet/runtime#78580)
* Add generic Enum.TryFormat method * Rewrite Enum using generic specialization per underlying type Also revises the shape of the newly added Enum.TryFormat method and fixes tests accordingly. * Use Enum.TryFormat in interpolated string handlers * Implement ISpanFormattable on Enum * Use generic Enum methods in more places * Replace Unsafe.As with unmanaged pointers where possible Reduces cost of the generic methods * Simplify Enum_GetValuesAndNames QCall, fix handling of floats and doubles This change avoids allocation of the temporary ulong[] array during EnumInfo initialization Fixes dotnet/runtime#29266 * Fix mono's GetEnumNamesAndValues, and make ToObject handle float/double as well * Fix perf gap and polish * Undo update of Enum.GetTypeCode to include float/double * Address PR feedback * Accomodate net8.0 TFM update * Fix InvalidCastException from GetEnumValues on mono when dealing with bool-based enums Co-authored-by: Heath Baron-Morgan <[email protected]> Co-authored-by: Jan Kotas <[email protected]> Commit migrated from dotnet/runtime@62f3eb2
- Loading branch information