public string SearchForTextOfTag(string tag)
{
// Search on each child in order and each
// child's child, depth-first
if (tag == null)
throw new ArgumentNullException(nameof(tag));
// Note: we don't check for a valid tag here because
// an invalid tag simply won't be found.
if (string.Equals(_tag, tag))
return Unescape(_text);
if (_children == null)
return null;
foreach (SecurityElement child in Children)
{
string text = child.SearchForTextOfTag(tag);
if (text != null)
return text;
}
return null;
}