Possible Duplicate:
How to convert numbers between hexadecimal and decimal in C#?
I’m having struggle with converting to signed int using c#
lets say I have the fallowing string:
AAFE B4FE B8FE
here we have 3 samples. each sample (signed 16 bits) is written as an ASCII hexadecimal sequence of 4 digits (2×2 digits/byte).
any suggestions?
Thank you.
If you need to specify the endian-ness of the parsed values (instead of assuming that they are in little-endian byte order), then you need to place each
bytein the appropriate place within the resultingshort.Note that exceptions will be thrown in
HexToByteif the string values are not well formatted.