public static ReadOnlyCollection <IImmutableHierarchy> Family(this IImmutableHierarchy node)
 {
     if (node == null)
     {
         return(Seq.Empty <IImmutableHierarchy>().ToReadOnly());
     }
     return(node.Concat(node.ChildrenRecursive()).ToReadOnly());
 }
 public static ReadOnlyCollection <IImmutableHierarchy> ChildrenRecursive(this IImmutableHierarchy node)
 {
     if (node == null)
     {
         return(Seq.Empty <IImmutableHierarchy>().ToReadOnly());
     }
     return(node.Children.Flatten(n => n == null ? Seq.Empty <IImmutableHierarchy>() : n.Children).ToReadOnly());
 }
 public static ReadOnlyCollection <IImmutableHierarchy> Hierarchy(this IImmutableHierarchy node)
 {
     if (node == null)
     {
         return(Seq.Empty <IImmutableHierarchy>().ToReadOnly());
     }
     return(node.Unfoldi(n => n.Parent, n => n != null).ToReadOnly());
 }
 public static ReadOnlyCollection <T> Family <T>(this IImmutableHierarchy <T> node)
     where T : class, IImmutableHierarchy <T>
 {
     return(((IImmutableHierarchy)node).Family().AssertCast <T>().ToReadOnly());
 }
 public static ReadOnlyCollection <T> ChildrenRecursive <T>(this IImmutableHierarchy <T> node)
     where T : class, IImmutableHierarchy <T>
 {
     return(((IImmutableHierarchy)node).ChildrenRecursive().AssertCast <T>().ToReadOnly());
 }