I just realized I added a value to the list of \"must-handle\" values in my enum, but I didn\'t catch it until runtime. I know the C# compiler is really powerful when it com
You can use a meta-method that checks at runtime, but at least checks the whole switch.
https://github.com/faisalmansoor/MiscUtil/blob/master/EnumSwitch/EnumSwitch.cs
No there's no compile-time way to make that happen. However the very VERY simple answer is to have a default
handler which simply throws an exception along the lines of, "this option wasn't handled, boo".
switch (c)
{
case Colors.Red: // no error, Red is a Color
break;
case Colors.Blue:
case Colors.Green: // no error, Blue and Green handled as well
break;
default:
throw new Exception("Unhandled option: " + c.ToString());
}