Salmon
Loading...
Searching...
No Matches
Mku.Convert.BitConverter Class Reference

Converts from/to byte arrays, integral values, and hex strings. More...

Static Public Member Functions

static byte[] ToBytes (long value, int length)
 Converts a long value to byte array.
 
static long ToLong (byte[] bytes, int index, int length)
 Converts a byte array to a long value. Little endian only.
 
static string ToHex (byte[] data)
 Convert a byte array to a hex representation.
 
static byte[] ToBytes (string data)
 Convert a hex string to a byte array.
 

Detailed Description

Converts from/to byte arrays, integral values, and hex strings.

Member Function Documentation

◆ ToBytes() [1/2]

static byte[] Mku.Convert.BitConverter.ToBytes ( long value,
int length )
static

Converts a long value to byte array.

Parameters
valueThe value to be converted.
lengthThe length of the byte array to be returned.
Returns
A byte array representation of the value.

◆ ToBytes() [2/2]

static byte[] Mku.Convert.BitConverter.ToBytes ( string data)
static

Convert a hex string to a byte array.

Parameters
dataThe hex string to be converted.
Returns
The byte array converted from the string.

◆ ToHex()

static string Mku.Convert.BitConverter.ToHex ( byte[] data)
static

Convert a byte array to a hex representation.

Parameters
dataThe byte array to be converted.
Returns
The hex string representation.

◆ ToLong()

static long Mku.Convert.BitConverter.ToLong ( byte[] bytes,
int index,
int length )
static

Converts a byte array to a long value. Little endian only.

Parameters
bytesThe byte array to be converted.
indexThe starting index of the data in the array that will be converted.
lengthThe length of the data that will be converted.
Returns
The long value representation of the byte array.

The documentation for this class was generated from the following file: