Cabster/Extensions/ControlsExtensions.cs
/// <summary>
/// Retorna todos os controls filhos. 
/// </summary>
/// <param name="target">Controle.</param>
/// <typeparam name="T">Control</typeparam>
/// <returns>Lista de controles</returns>
Retorna todos os controls filhos.
Retorna todos os controls filhos .
public static IEnumerable<Control> AllControls<T>(this T target) where T : Control
        {
            var controls = new List<Control>();
            void Collect(Control control)
            {
                controls.Add(control);
                foreach (Control child in control.Controls)
                {
                    Collect(child);
                }
            }
            Collect(target);
            return controls;
        }
public static IEnumerable < Control > AllControls < T > ( this T target ) where T : Control { var controls = new List < Control > ( ) ; void Collect ( Control control ) { controls . Add ( control ) ; foreach ( Control child in control . Controls ) { Collect ( child ) ; } } Collect ( target ) ; return controls ; }
Retorna todos os controls filhos.
Retorna todos os controls filhos .
Lista de controles
Lista de controles
T
this
target
None
typeparam
None