Convert the leftmost four bytes of an array to an unsigned 32-bit integer.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntaxpublic static uint NumFromBytes(
byte[] b,
CnvEndianNess endn = CnvEndianNess.BigEndian
)
Public Shared Function NumFromBytes (
b As Byte(),
Optional endn As CnvEndianNess = CnvEndianNess.BigEndian
) As UInteger
Parameters
- b Byte
- Byte array to be converted
- endn CnvEndianNess (Optional)
- Byte order
Return Value
UInt32Integer value
RemarksAn array shorter than 4 bytes will be padded on the right with zeros
Examplebyte[] b = new byte[4] { 0xde, 0xad, 0xbe, 0xef };
uint nb = Cnv.NumFromBytes(b, Cnv.EndianNess.BigEndian);
Console.WriteLine("0x" + nb.ToString("x8"));
uint nl = Cnv.NumFromBytes(b, Cnv.EndianNess.LittleEndian);
Console.WriteLine("0x" + nl.ToString("x8"));
See Also