/ Published in: C#
Found in the above URL. Requires extension methods (C# 3.0+).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
foreach (var control in Controls.All()) {} public static IEnumerable<Control> All(this Control.ControlCollection controls) { foreach (Control control in controls) { foreach (Control grandChild in control.Controls.All()) yield return grandChild; yield return control; } }
URL: http://www.devx.com/dotnet/Article/41639/0/page/3