Convert an array of bytes into one decimal number as a string

Posted by Martin Kirsche on Stack Overflow See other posts from Stack Overflow or by Martin Kirsche
Published on 2010-03-11T09:43:37Z Indexed on 2010/03/12 0:47 UTC
Read the original article Hit count: 404

Filed under:
|

I'm trying to write function that converts an arbitrary large array of bytes (larger than 64-bit) into a decimal number represented as string in c# and I simply can't figure out how to do it.

For example the following code ...

Console.WriteLine(ConvertToString(
  new byte[]
  { 
    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 
    0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00
  }));

.. should print out

22774453838368691933757882222884355840

I don't want to just use an extra library like biginteger for that, because I want it to be simple and like to understand how it works.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#