Recursive control search with LINQ
问题 If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query. var checkBoxes = this.Controls .OfType<CheckBox>() .TakeWhile<CheckBox>(cb => cb.Checked); That works fine if the checkboxes are nested in the current control collection, but I\'d like to know how to extend the search by drilling down into the control collections of the top-level controls. The question was asked here: Finding controls that use a certain interface in ASP.NET And received non-LINQ