i need to implement some kind of bit to status mapping and i don’t know how to implement this thing – maybe i have a blockhead 😉
Okay so i have a status-code which can be max. 32 bit long for example 1001 0011
Each bit belongs to a special status code – string.
For example:
Bit 1: String Cancel
Bit 2: String Okay
Bit 3: String Save
....
Bit 32: String Next
Now i have to determine which bits are set and return all status code – strings which are set int the 32 bit long status.
I like to prefer some kind of dictionary or sumthin like that where i can store for each bit the corresponding status code.
Then i like to loop thru the 32 bit long status code and get the corresponding status code string out of the dictionary – store it in a string and return it after the 32 bit long status code has been looped through.
Somebody has an idea for that?
you can use enums with flags attribute. Enum can be cast from and to int.
Each enum value can be set so your status can look like this
Flags attribute
you can test with