0

in trying to convert this string 0x0000F85D
to integer value i tried all the popular methods but did not worked any ideas please var hello= "0x0000F85D"; var i = ??? ;

  • 5
    Possible duplicate of [C# convert integer to hex and back again](https://stackoverflow.com/questions/1139957/c-sharp-convert-integer-to-hex-and-back-again) – Equalsk Oct 16 '17 at 16:28
  • the int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber) method only works without the leading 0x. The docs ( https://msdn.microsoft.com/en-us/library/system.globalization.numberstyles(v=vs.110).aspx )say that Strings that are parsed using this style cannot be prefixed with "0x" or "&h" – Miniver Cheevy Oct 16 '17 at 16:45

1 Answers1

2
Convert.ToInt32("0x0000F85D", 16);

Have a read here: https://msdn.microsoft.com/en-us/library/1k20k614(v=vs.110).aspx

Alander
  • 561
  • 1
  • 6
  • 15
romerotg
  • 439
  • 2
  • 11