title: Converting binary to decimal
body: <p>I have a requirement where I am generating a binary number from a string say "111111" and converting it to a decimal number to store in database. Each digit (ie. 1/0) from this binary number signifies different access rights of user to different modules in the application. As and when the number of modules will increase, the number of digits in this binary number will also increase. By the time when the binary number reached to the length of 64, (ie. 64 times 1s), I was able to convert it to decimal number using </p>
  
  <pre><code>Int64 dec =Convert.ToInt64(binVal,2);
  </code></pre>
  
  <p>And it worked fine. But when the length increased to 65, it gave an OverFlow Exception : Value was either too large or too small for a UInt64. Can anyone suggest any possible solution where I can convert this binary number of 65 length to decimal or any other form to save it in database. </p>
  
  <p>Thanks in Advance.</p>