christrinder
09-13-2007, 12:37 PM
Hi all. I'm having problems with enums. I thought I understood how to use them, but clearly I don't! I want to use them to refer to corresponding ID's in a database within the code (to make it more readable). So I set-up:
public enum ItemStatus
{
Incomplete = 1,
PendingApproval = 2,
Rejected = 3,
Approved = 4,
}
...it all looked good in the code, but I'm getting some odd results when I use the application. I've read in different places that;
- I might need a zero value
- they need to be alphabetically ordered
- they need to increment in powers of 2
... none of which fit easilly with my database. Is there a better way to do this?
public enum ItemStatus
{
Incomplete = 1,
PendingApproval = 2,
Rejected = 3,
Approved = 4,
}
...it all looked good in the code, but I'm getting some odd results when I use the application. I've read in different places that;
- I might need a zero value
- they need to be alphabetically ordered
- they need to increment in powers of 2
... none of which fit easilly with my database. Is there a better way to do this?