views:

60

answers:

1

I've got some HTML:

<html>
<head>
    <title>title</title>
</head>
<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...

+3  A: 

Hello good sir,

That's because the equality operator is not overridden! Try using

p.ParentNode.XPath == body.XPath

instead!

Mark
Genius. [ ](http://w)
NullUserException
I am outraged. The questioner still didn't mark your answer as correct!%)
MAKKAM
@MAKKAM: I can't for another 2 days :(
Mark