I have a signed hex string FFFF
which is signed. So when I convert it to an integer it should be -1. But when I use int.Parse
/int.TryParse
or System.Convert.ToInt32
it gives me the value 65535
.
var rawValue = int.Parse("FFFF", System.Globalization.NumberStyles.HexNumber);
// rawValue = 65535
var rawValue = Convert.ToInt32("FFFF", 16);
// rawValue = 65535
Any ideas how I can get the parse/convert functions to recognise its a signed hex string?