Conversions

Only explicit conversions are possible for converting to (from) any integer type (not char, though) from (to) an enum type by using the cast operator (<Type>). However, the number 0 (zero) is an exception. It can be implicitly converted to an enumerator type; the reason is displayed in the Tip box.

It is also possible to explicitly convert one enumerator type to another enumerator type.

Tip

The only numeric value that can be implicitly converted to an enumerator type is 0.

To reset or initialize an enumeration variable is the equivalent of assigning it the first member of the enumeration. If the first member of any enumeration is always ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.