How do I parse a string with either a decimal number like 1234 or hexadecimal number prefixed with 0X1234 to an int in C#?
I have tried
int.TryParseand Convert.ToInt32 But it seems like these function assumes that you know if you want to parse a decimal or a hexidecimal value on prehand. I want to allow my user to input both formats.
Are there any standard functions that can decide by them selves if the input is formatted in hex or decimal format? Or do I have to write it myself?