我试图从xml设置文件加载一个十六进制文字,我可以很好地解析xml并从文件中获取所需的字符串,
但我似乎无法设置一个int变量值:/
码:
int PlayerBaseAddress = System.Convert.ToInt32(ConfigLoader.GetSetting("PlayerBaseAddress"));
// Input string was not in a correct format.
public static string GetSetting(string Val)
{
// This loads from the xml file, Pretend its hardcoded to return a string of 0x17EAAF00
}
int PlayerBaseAddress = 0x17EAAF00; // This works.
Run Code Online (Sandbox Code Playgroud)
您必须为重载方法提供字符串的基础Convert.ToInt32(String value, Int32 fromBase).
Int32 value = Convert.ToInt32(hexString, 16);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1524 次 |
| 最近记录: |