"Rich" <Ri**@discussions.microsoft.comwrote in message
news:B1**********************************@microsof t.com...
Dear All,
Does anyone know the algorithm used to convert to an sbyte like follows?
It
is not a straight hex conversion.
sbyte.Parse("B2", System.Globalization.NumberStyles.HexNumber, null);
It is a straight hex conversion and ends up storing the same binary value in
the byte as it would in an unsigned byte. Its how the binary value is then
interpreted as a number. The top bit being set indicates its a negative
number in signed byte.
The algorithm is called 2's complement. See:-
http://en.wikipedia.org/wiki/Two's_complement
--
Anthony Jones - MVP ASP/ASP.NET