Hello.
I want to be able to generate large binary numbers in C#, based on an integer, and later perform a bitwise operation on them - I'm talking being able to support numbers up to (and hopefully even beyond, just in case, 2^100)
The basis is that I have a database table with roughly 70 rows, each row has a unique identity value (1, 2, 3, 4, etc) and from that ID I want to generate a matching binary number, something like 2^(ID - 1). So, the binary ID for the row ID of 3 would be 4 = 2^(3-1). The binary ID for a row ID of 4 would be 8 = 2^(4-1). etc, etc. Any ideas on how to go about this? Or even what datatypes to use?
For those who care about the reasoning; I have a webpage in which users can view one, more or all of the values within this table and rather than pass 70+ IDs in the querystring I wanted to be able to pass in a binary number representing the selected rows; eg, Rows=9 would mean showing rows 1 and 4 (2^(1-1) = 1 + 2^(4-1) = 8) = 9.
Thanks
I want to be able to generate large binary numbers in C#, based on an integer, and later perform a bitwise operation on them - I'm talking being able to support numbers up to (and hopefully even beyond, just in case, 2^100)
The basis is that I have a database table with roughly 70 rows, each row has a unique identity value (1, 2, 3, 4, etc) and from that ID I want to generate a matching binary number, something like 2^(ID - 1). So, the binary ID for the row ID of 3 would be 4 = 2^(3-1). The binary ID for a row ID of 4 would be 8 = 2^(4-1). etc, etc. Any ideas on how to go about this? Or even what datatypes to use?
For those who care about the reasoning; I have a webpage in which users can view one, more or all of the values within this table and rather than pass 70+ IDs in the querystring I wanted to be able to pass in a binary number representing the selected rows; eg, Rows=9 would mean showing rows 1 and 4 (2^(1-1) = 1 + 2^(4-1) = 8) = 9.
Thanks
Comment