HtmlTree <HtmlNode>?GetSibling(int offset, Func <int, int, bool> predicate) { if (!HasParent) { return(null); } var siblings = Parent.Value.Node.ChildNodes; var i = siblings.IndexOf(Node); return(predicate(i + offset, siblings.Count) ? HtmlTree.Create(siblings[i + offset], AncestorStack) : (HtmlTree <HtmlNode>?)null); }
public HtmlTree <T> Cast <T>() where T : HtmlNode => HtmlTree.Create((T)(HtmlNode)Node, _ancestorStack);