Пример #1
0
        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);
        }
Пример #2
0
 public HtmlTree <T> Cast <T>() where T : HtmlNode =>
 HtmlTree.Create((T)(HtmlNode)Node, _ancestorStack);