Handling bitmask values
Posted on 2009-05-05
I'm searching for a logical syntax or method for handling following problem.
I have 3 values in bitmask format:
1 = A
2 = B
4 = C
Possible values are: 1, 2, 3, 4, 5, 6 and 7.
Now I want a kind of for-each-loop to insert the values A, B and/or C in the database.
Incoming value = 1
Single insert into database: A
Incoming value = 7
Three inserts into database: A, B and C.
What is the fastest way to do this in C# .net?
Thanks in advance.