If you are on .NET 2.0, you can do something similar: put your Nodes in the (common) list and use Find(...). Line by line:
string urlToLookFor = "myPageURL";
List<SiteMapNode> myListOfNodes = new
List<SiteMapNode>(SiteMap.RootNode.GetAllNodes());
SiteMapNode foundNode = myListOfNodes.Find(delegate(SiteMapNode currentNode)
{
return currentNode.Url.ToString().Equals(urlToLookFor);
});
if(foundNode != null) {
...
}
This way you do not need to iterate manually. If it is “better,” this is another question.
source
share