public static IEnumerable <TreeIter> Children(this TreeModel model, TreeIter parent) { List <TreeIter> children = new List <TreeIter>(); if (parent.Equals(TreeIter.Zero)) { for (int i = 0; i < model.IterNChildren(); i++) { TreeIter iter; if (model.IterNthChild(out iter, i)) { children.Add(iter); children.AddRange(model.Children(iter)); } } } else { for (int i = 0; i < model.IterNChildren(parent); i++) { TreeIter iter; if (model.IterNthChild(out iter, parent, i)) { children.Add(iter); children.AddRange(model.Children(iter)); } } } return(children); }