Skip to content

Instantly share code, notes, and snippets.

@kg
Created May 3, 2011 06:54
Show Gist options
  • Save kg/952923 to your computer and use it in GitHub Desktop.
Save kg/952923 to your computer and use it in GitHub Desktop.
public abstract class JSNode {
public virtual IEnumerable<JSNode> Children {
get {
yield break;
}
}
public IEnumerable<JSNode> AllChildrenRecursive {
get {
foreach (var child in Children) {
yield return child;
foreach (var subchild in child.AllChildrenRecursive)
yield return subchild;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment