나는 .. 여기 연결할 수없는 코드가 감지 되었습니까?
코드입니다 ...이 rediculous 오류가 "unreachablecode 감지"적절한 visibiliity에서 명확하게 모든 것을 얻고int lastAppNum = 0;
//load the xml document
XmlDocument xdoc = new XmlDocument();
xdoc.Load(GlobalVars.strXMLPath);
//add a app node
XmlNode newApp = xdoc.CreateNode(XmlNodeType.Element, "app", null);
//add the app number - this will be used in order to easily identify the app details (used for overwriting/saving)
XmlAttribute newNum = xdoc.CreateAttribute("num");
//in order to create a new number - search the last num and add one to it
foreach (XmlNode xmlAppChild in xdoc.ChildNodes)
{
//if there are existing child nodes
if (true)
{
//get the last childs num attribute
lastAppNum = Convert.ToInt32(xmlAppChild.LastChild.Attributes["num"].Value);
//add +1 to the last app num
lastAppNum++;
//add the new value to the attribute
newNum.InnerText = lastAppNum.ToString();
break;
}else{
//if there isnt an existing child node - set the num to 1
lastAppNum = 1; <<where the error happens
newNum.InnerText = lastAppNum.ToString();
break;
}
}
사람이 세드릭 아이디어의가 있습니까? 나는 아마 그것이 "휴식"의 부족이라고 생각했기 때문에 나는 여기에 두 개를 던졌다. (나는 해결책이 무엇인지를 보았다.) 그러나 그것은 문제가되지 않았고 오류는 여전히 일어나고있다. 어떤 제안이라도 좋을 것입니다.
가'하면'아마 항상 '참 (true)가 될 것이다 아래로도 구현을 변경해야 ':) –
@ user3302467 : 경고 수준을 올바르게 설정하면 연결할 수없는 코드가 오류가 아닙니다. 사용자에게 의도하지 않은 무언가를 썼다는 경고가됩니다. –
모든 경고 사항은 무엇입니까? 왜 모두 오류로 취급해야합니까? – paulm