public static IEnumerable <Control> Flatten(this ControlCollection controls) { List <Control> list = new List <Control>(); controls.Traverse(c => list.Add(c)); return(list); }
public static IEnumerable <Control> Flatten( this ControlCollection controls, Func <Control, bool> predicate) { List <Control> list = new List <Control>(); controls.Traverse(c => { if (predicate(c)) { list.Add(c); } }); return(list); }