We can better have an extension like:
public static class ControlExtension
{
public static IList<t> FindControlByName<t>(this Control control) where T : Control
{
List<t> controlsFound = new List<t>();
controlsFound.AddRange(control.Controls.OfType<t>());
foreach (Control c in control.Controls)
{
controlsFound.AddRange(FindControlByName<t>(c));
}
return controlsFound;
}
}
and perform:
this.FindControlByName<textbox>().ToList().ForEach(t => t.Clear());