Convert a 32-bit integer to an array of 4 bytes.
public static byte[] NumToBytes( uint n, Cnv.EndianNess endn )
Public Shared Function NumToBytes ( _ n As UInteger, _ endn As Cnv.EndianNess _ ) As Byte()
byte[] bb = Cnv.NumToBytes(0xdeadbeef, Cnv.EndianNess.BigEndian); Console.WriteLine(Cnv.ToHex(bb)); // DEADBEEF byte[] bl = Cnv.NumToBytes(0xdeadbeef, Cnv.EndianNess.LittleEndian); Console.WriteLine(Cnv.ToHex(bl)); // EFBEADDE
VB6/C equivalent: CNV_NumToBytes