For some reason the following C# Console program always outputs:
32
False
wtf=0
What am I doing wrong?
See also http://msdn.microsoft.com/en-us/library/kadka85s%28v=VS.100%29.aspx In the example at the bottom of the page:
Attempted conversion of '0x8F8C' failed.
You need to drop the "0x" prefix. Please see this blog entry
Get rid of the leading "0x" in the string you're trying to parse.
// stupid but effective way to improve the parsing
char[] _trim_hex = new char[] {'0','x'};
int temp;
if (int.TryParse(value.TrimStart(_trim_hex), NumberStyles.HexNumber, null, out temp))
{
// temp is good
}