CryptoSys PKI Pro Manual

Cnv.NumToBytes Method

Convert a 32-bit integer to an array of 4 bytes.

Syntax

[C#]
public static byte[] NumToBytes(
	uint n,
	Cnv.EndianNess endn
)
[VB.NET]
Public Shared Function NumToBytes ( _
	n As UInteger, _
	endn As Cnv.EndianNess _
) As Byte()

Parameters

n
Integer to be converted
endn
Type: Cnv.EndianNess
Byte order

Return Value

Byte array containing representation of integer in given order

Example

[C#]
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

See Also

VB6/C equivalent: CNV_NumToBytes

[Contents] [Index]

[PREV: Cnv.NumFromBytes Method...]   [Contents]   [Index]   
   [NEXT: Cnv.ReverseBytes Method...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.