Closed riverar closed 6 months ago
Oh boy, I wish we could.
But C# doesn't allow defining constants typed as a custom struct. That as you see in the error precludes them from being used in a switch
statement. If HRESULT was an enum it would work, but after a long discussion it was decided that HRESULT should not be expressed as an enum for a few reasons, including:
So I'm afraid C# forces code to use if
statements instead.
Actual behavior
Expected behavior
Naturally switch on HRESULT values against compile-time statics.
Context
LangVersion
(if explicitly set by project): [e.g.9
]