我收到以下错误(我有一个报告我的问题的自定义错误控制台
7:09:17 PM > # ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
7:09:17 PM > # Parameter name: i
当我尝试从XML文件GemsCraftConfig.gc
<?xml version="1.0" encoding="utf-8"?>
<GemsCraft Donator="True" />
这是我用来执行操作的代码......它在Visual Basic中运行良好,但当我通过在线转换器时它
XmlTextReader Reader = new XmlTextReader("GemsCraftConfig.gc");
string DonatorEnabled = Reader.GetAttribute(0);
if (DonatorEnabled == "True")
{
//Code is cut off from here on
答案 0 :(得分:1)
如何使用LinqToXml
bool donator = (bool)XDocument.Load("GemsCraftConfig.gc")
.Root.Attribute("Donator");