Mega Code Archive

 
Categories / C# / Development Class
 

Convert specified 32-bit unsigned integer value to an array of bytes

using System; class GetBytesUInt32Demo {     const string formatter = "{0,16}{1,20}";     public static void GetBytesUInt32( uint argument )     {         byte[ ] byteArray = BitConverter.GetBytes( argument );         Console.WriteLine( formatter, argument, BitConverter.ToString( byteArray ) );     }     public static void Main( )     {         GetBytesUInt32( 15 );     } }