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
Just by throwing (pun unintended) this out, you can replace the Switch-Case with a dictionary (Func as an example):
Dictionary> d = new Dictionary>();
d.Add(Colors.Red, (x) => x+1);
d.Add(Colors.Blue, (x) => x+1);
d.Add(Colors.Green, (x) => x+1);
foreach (Colors color in Enum.GetValues(typeof(Colors)))
{
if (!d.ContainsKey(color))
{
throw new Exception("Poor color " + color + " ignored");
}
}