I want to make an extension method to check if an enumeration has a flag.
DaysOfWeek workDays = DaysOfWeek.Monday | DaysOfWeek.Tuesday | DaysOfWeek.Wednesday;
// instead of this:
if ((workDays & DaysOfWeek.Monday) == DaysOfWeek.Monday)
...
// I want this:
if (workDays.ContainsFlag(DaysOfWeek.Monday))
...
How can I accomplish this? (If there is a class that already does this then I would appreciate an explanation to how this can be coded; I've been messing around with this method far too long!)
thanks in advance