/// <summary> /// Gets all child nodes of <paramref name="node"/>. /// </summary> /// <param name="node">The node.</param> /// <returns>All child nodes.</returns> public static IEnumerable <INode> GetChildNodes(this INode node) { var l = new List <INode>(); NodeWalker.ForEachChild <object>(node, child => { l.Add(child.ResolveUnionType()); return(null); }); return(l); }
/// <summary> /// Invokes <paramref name="func"/> callback for each child of the given node. /// Travesal stops when <paramref name="func"/> returns a 'truthy' value which is then returned from the function. /// </summary> public static T ForEachChild <T>(this INode node, Func <INode, T> func) where T : class { return(NodeWalker.ForEachChild(node, func)); }