Mega Code Archive

 
Categories / C# / Data Types
 

Converts a BigInteger value to a byte array

using System; using System.Numerics; public class Example {    static byte[] bytes;    public static void Main()    {       BigInteger[] numbers = { Int64.MinValue, Int64.MaxValue, };       foreach (BigInteger number in numbers)       {          bytes = number.ToByteArray();          foreach (byte byteValue in bytes)             Console.Write("{0:X2} ", byteValue);       }       } }