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
sizeof on an enum type is a compile-time constant and it's the size of that enum type at compile-time. This could be surprising at first --- and it means if an enum's underlying type (from a referenced assembly) is modified after compilation, the code needs to recompile.
This fact should be mentioned in the documentation.
@BillWagner Could you reopen the issue, now with proper feedback information? It was closed by the bot due to "lack of information", but the issue creation page will constantly reset feedback text into [Enter feedback here] so it's very unergonomic to create an issue with any feedback text. (Yes, I can try pasting the text and clicking "Create" very fast before the offending reset kicks in, but...)
I'd like to pick this up. I'll add a bullet to the sizeof operator page noting that sizeof on an enum type yields the size of its underlying integral type, that the size is evaluated at compile time, and that changing the underlying type of an enum in a referenced assembly requires recompiling consumers to observe the new size. PR shortly.
Activity
GeeLaw commentedon Jun 23, 2026
@BillWagner Could you reopen the issue, now with proper feedback information? It was closed by the bot due to "lack of information", but the issue creation page will constantly reset feedback text into
[Enter feedback here]so it's very unergonomic to create an issue with any feedback text. (Yes, I can try pasting the text and clicking "Create" very fast before the offending reset kicks in, but...)Sem909 commentedon Jun 23, 2026
Open
heissenberg06 commentedon Jun 28, 2026
I'd like to pick this up. I'll add a bullet to the sizeof operator page noting that sizeof on an enum type yields the size of its underlying integral type, that the size is evaluated at compile time, and that changing the underlying type of an enum in a referenced assembly requires recompiling consumers to observe the new size. PR shortly.