The problem is after the node.parentNode is null it's returning but it's going back to the GetPath function and executing and returning it. so what should I do? Due to this my program is running for a very long time
C#:
public static List<string> GetPath(XmlNode node, List<string> parentList)
{
if (node.ParentNode == null)
{
return parentList;
}
else
{
if (node.FirstChild.Name == "SHORT-NAME")
{
parentList.Add("/" + node.FirstChild.InnerText);
}
parentList = GetPath(node.ParentNode, parentList); //RECURSIVE
return parentList;
}
}
Last edited by a moderator: