Skip to content

Instantly share code, notes, and snippets.

@tdewilde
Created January 9, 2014 10:02
Show Gist options
  • Select an option

  • Save tdewilde/8331970 to your computer and use it in GitHub Desktop.

Select an option

Save tdewilde/8331970 to your computer and use it in GitHub Desktop.
Get all child controls for a certain control.
public static IEnumerable<Control> AllChildControls(this Control control)
{
var children = control.Controls.Cast<Control>();
return children.SelectMany(c => AllChildControls(c)).Concat(children);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment