Mega Code Archive

 
Categories / C# / Development Class
 

Convert 64-bit signed integer value to an array of bytes

using System; class GetBytesInt64Demo {     const string formatter = "{0,22}{1,30}";     public static void GetBytesInt64( long argument )     {         byte[] byteArray = BitConverter.GetBytes( argument );         Console.WriteLine( formatter, argument, BitConverter.ToString( byteArray ) );     }     public static void Main( )     {         GetBytesInt64( 0 );         GetBytesInt64( 0xFFFFFF );     } }