Why do these two nodes not compare equal?
I've got some HTML:
<html>
<head>
<title>title</title>
</head>
开发者_JAVA百科<body>
<p>a pargraph</p>
</body>
</html>
For which I grab the body
and p
node, and then I tried
Console.WriteLine(p.ParentNode == body);
And it's telling me False. Why is that? I need this functionality in my program...
That's because the equality operator is not overridden! Try using
p.ParentNode.XPath == body.XPath
instead!
精彩评论