Convert single-precision floating point value to an array of bytes.
using System;
class GetBytesSingleDemo
{
const string formatter = "{0,16:E7}{1,20}";
public static void GetBytesSingle( float argument )
{
byte[ ] byteArray = BitConverter.GetBytes( argument );
Console.WriteLine( formatter, argument, BitConverter.ToString( byteArray ) );
}
public static void Main( )
{
GetBytesSingle( 0.0F );
GetBytesSingle( 1.0F );
}
}
Related examples in the same category