Convert specified 16-bit unsigned integer value to an array of bytes.
using System;
class GetBytesUInt16Demo
{
const string formatter = "{0,10}{1,13}";
public static void GetBytesUInt16( ushort argument )
{
byte[ ] byteArray = BitConverter.GetBytes( argument );
Console.WriteLine( formatter, argument, BitConverter.ToString( byteArray ) );
}
public static void Main( )
{
GetBytesUInt16( 15 );
}
}
Related examples in the same category