MessageButton

Topics: Questions
Feb 14, 2013 at 11:59 AM
Edited Feb 14, 2013 at 12:10 PM
given:
[Flags]
public enum MessageButton
{
    OK = 1,
    OKCancel = 2,
    YesNo = 4,
    YesNoCancel = 8
}
Why not:
[Flags]
public enum MessageButton
{
    OK = 1,
    Cancel = 2,
    Yes = 4,
    No = 8,
    OKCancel = OK|Cancel,
    YesNo = Yes|No,
    YesNoCancel = YesNo|Cancel
}
So in Code it is much easier to handle.

And the Flags Attribute in your case makes no sense!
Coordinator
Feb 19, 2013 at 6:20 PM
Good question. I think this is because you cannot combine OK and Yes for example.
Feb 20, 2013 at 6:40 AM
Ok. But then delete the Attribute Flags. Or do you wan't to combine Ok and OKCancel for example :-)
Coordinator
Feb 20, 2013 at 7:34 AM
In WinRT, we use the Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.OK), so I am not going to remove it right now. That doesn't mean that you are not right, it simply means I am not sure if it is safe to remove them and I don't have time to figure that out at the moment.