-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 (#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 #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 <heathbm@outlook.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com>
- Loading branch information
1 parent
6e0c046
commit 62f3eb2
Showing
38 changed files
with
2,361 additions
and
1,355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.