enums bitwise values.

  • Thread starter Thread starter Ibrahim.
  • Start date Start date
I

Ibrahim.

Hello,

I have a enum structure like this ;

[Flags]
public enum days
{
Sun=1,
Mon=2,
Tue=4,
Wed=8,
Thur=16,
Fri=32,
Sat=64
}

now i sum only sun & fri & save to database table field

int daysSelected = (int) days.sun | days.fri

now i want to get the enum values from daysSelected again ?

thanks.
 
Ibrahim. said:
I have a enum structure like this ;

[Flags]
public enum days
{
Sun=1,
Mon=2,
Tue=4,
Wed=8,
Thur=16,
Fri=32,
Sat=64
}

now i sum only sun & fri & save to database table field

int daysSelected = (int) days.sun | days.fri

=> 'days daysselected = days.sun | days.fri;'
now i want to get the enum values from daysSelected again ?

\\\
bool sunset = (daysselected & days.sun) != 0;
///
 
Back
Top