Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
Support for formatting, parsing, and conversions of Boolean-backed enumeration types has been removed.
Previous behavior
Previously, formatting, parsing, or converting a Boolean-backed enumeration type was somewhat functional.
New behavior
Starting in .NET 8, an InvalidOperationException is thrown if you try to format, parse, or convert a Boolean-backed enumeration type.
Version introduced
.NET 8 Preview 1
Type of breaking change
This change is a behavioral change.
Reason for change
This change was made to make the .NET runtime simpler, faster, and smaller. Formatting and parsing Boolean-backed enumeration types is never used in practice and complicates the implementation. Also, Boolean-backed enum types aren't expressible in C#.
Recommended action
If you're using a Boolean-backed enumeration type, use a regular Boolean type or a byte-backed enumeration type instead.