Q: Switch on enum with Flags I have the following enum
[Flags]
public enum Anchor
{
    None = 1,
    Top = 2, Bottom = 4,
    Left = 8, Right = 16
}

I need to test every possible combination of Top, Bottom, Left and Right but declaring all those combinations in a switch is awful.
switch (anchor)
{
    case Anchor.Left:
        Thing1();
        break;

    case Anchor.Top:
        Thing2();
        break;

    case Anchor.Left | Anchor.Top:
        Thing3();
        break;
}

This question is not a duplicate of this or this. I've tried both solutions and neither works for me because if my enum is, say Anchor.Left | Anchor.Top, Thing1() and Thing2() would be called whereas I need Thing3() to be called.

A: Declare all these combinations in a switch. (as you started)
Its clear, understandable, maintainable.
Not awful. (Feels just a bit stupid to key it in)
After all, you have these distict cases, so a switch is the perfect construction.
