C# Parse string to int


I have a program where I hard read some offsets, right now the offsets are hard coded in my code like this:

public static int VecViewOffset = 0x00000104;
public static int VecPunch = 0x00002FF8;

But what I would like to do is to read these offsets from a .ini / .txt file so I do not have to change the offsets in in my code which I did. How ever, I read the offset as a string from the file and I need to parse it to and int. But it doesn't work.

This is how I am trying to do it.

public int GetInt(string section, string key)
    var keyValue = SettingsData[section][key];
    var setting = int.Parse(keyValue);
    return setting;

I can parse "12" to and in just fine, but I can't parse "0x00000104" to and int Any ideas? .

asked on Stack Overflow Dec 15, 2015 by Joakim Carlsson • edited Dec 15, 2015 by Glorin Oakenfoot

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0