Click or drag to resize

CnvNumFromBytes Method

Convert the leftmost four bytes of an array to an unsigned 32-bit integer.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntax
public static uint NumFromBytes(
	byte[] b,
	CnvEndianNess endn = CnvEndianNess.BigEndian
)

Parameters

b  Byte
Byte array to be converted
endn  CnvEndianNess  (Optional)
Byte order

Return Value

UInt32
Integer value
Remarks
An array shorter than 4 bytes will be padded on the right with zeros
Example
C#
byte[] b = new byte[4] { 0xde, 0xad, 0xbe, 0xef };
uint nb = Cnv.NumFromBytes(b, Cnv.EndianNess.BigEndian);
Console.WriteLine("0x" + nb.ToString("x8"));  // 0xdeadbeef
uint nl = Cnv.NumFromBytes(b, Cnv.EndianNess.LittleEndian);
Console.WriteLine("0x" + nl.ToString("x8"));  // 0xefbeadde
See Also