use*_*009 2 c# methods error-handling dictionary function
我编写了以下代码来计算XML文件的节点:
private Dictionary<string, int> ExtractNodeInfo(string fileContent)
{
XmlDocument xmlDocument;
xmlDocument = new XmlDocument();
xmlDocument.Load(fileContent);
var ediNodes = xmlDocument.DocumentElement.SelectNodes("/EDI");
Dictionary<string, int> nodeCount = new Dictionary<string, int>();
foreach (XmlNode nodes in ediNodes)
{
FileManager.nodeRecurse(nodes, nodeCount);
}
foreach (var entry in nodeCount)
{
Console.WriteLine(entry.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
但是它给了我以下错误:'XmlFileManager.FileManager.ExtractNodeInfo(string)':并非所有代码路径都返回一个值.