I need a function to convert hex values in the format 0xFFFF
(2 Bytes) to decimal (unsigned and signed).
For example:
0xFFFE
is 65534
(unsigned)
0xFFFE
is -2
(signed)
I need also the same thing for 4 Bytes and 1 Byte.
All these options (3 * 2 options) I need to convert back - from decimal to hex (total 12 options).
My function should look like this:
string Myconverter(int ByteSize, bool IsFromHextoDecimal, bool IsSigned)
{
...
}
If there's build in functionality that performs these conversions, I'd like to a reference/link.