我正在使用具有以下结构的DevExpress枚举:
public enum RecurrenceDay
{
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday = 8,
Thursday = 16,
Friday = 32,
Saturday = 64,
WeekendDays = Sunday | Saturday,
WorkDays = Monday | Tuesday | Wednesday | Thursday | Friday,
EveryDay = WeekendDays | WorkDays
}
如果用户在DevExpress控件中选择星期日和星期一,则存储的值为3,即星期日(1)+星期一(2)的总和。 我的问题如下,我需要从一个数字中知道从枚举中选择了哪些值。
Example:
6 = []{ Monday, Tuesday };
如果不创建包含所有可能组合的查找表,这是否可行?