enums bitwise values.

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.
 
H

Herfried K. Wagner [MVP]

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;
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top