i have this code in c#
doc.SelectSingleNode("WhoisRecord/registrant/email").InnerText
how can i check whether it is returning null?
By null do you mean that the element doesn't exist?
try
{
var n = doc.SelectSingleNode("WhoisRecord/registrant/email");
if (n == string.Empty) {
// empty value
}
// has value
DoSomething(n.InnerText);
}
catch (XPathException)
{
// null value.
throw;
}
I don't sure that it is correct, I need to test it.