public static void VisitElements(XElement source, XElementVisitor func, int depth) { func(source, depth); foreach (XElement child in source.Elements()) { VisitElements(child, func, depth + 1); } }
public static void VisitElements(this XElement source, XElementVisitor func) { VisitElements(source, func, 0); }