I have many flags that I want to store them in an integer, so that later I can perform bitwise AND operation on them. The number of these flags may be up to 1000. However, there are no types in C# that can store 1000 bits.
For Example, I want to perform (&) operation onü
100000010000000011100000000000000000000000000000...........00001 --> (1000 flags)
000000000000000001111110000000000000000000010101.......... 11111 --> (1000 flags)
So, how can I perform this (&) operation on a two bit collections?
I have many flags that I want to store them in an integer, so that later I can perform bitwise AND operation on them.
That's a non-sequitur. You can use BitArray with its And method to satisfy that requirement without artificially going via a numeric type.
If you haven't logically got a number (and "many flags" doesn't sound like a number to me) you shouldn't go out of your way to use a numeric representation.
I guess BigInteger is what you are looking for. It has BitwiseAnd operator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With