Often I am using a switch-case, and creating a case for all enum items.
Is there a shortcut (it may well be a resharper shortcut) which creates all cases automatically and just let me fill the cases?
Or is this question related to code-snippet subject? Is it possible to create a dynamic code-snippet (it will vary according to enum type) ?
[Flags]
, or just arbitrary values). Frankly, IMO - whatever IDE tooling you use, great, but adding adefault
case that throws a suitable exception should be fairly standard practice. And tests. It is notable that F# has better treatment here (at least, for discriminated unions) – FreiArgumentOutOfRangeException
. – Bittencourt