ExtensionMethod.NET Home of 874 C#, Visual Basic, F# and Javascript extension methods


Used in conjunction with GetChildren(), it will return a list of T from a list of children of a control. Get Children is located at: http://www.extensionmethod.net/Details.aspx?ID=309


public static List<T> FindControlsByType<T>(this Control ctrl)
  return ctrl.GetChildren().OfType<T>().ToList();


List<TextBox> textboxes = Control.FindControlsByType<TextBox>();

Author: Ryan Helms

Submitted on: 18 jul 2010

Language: C#

Type: System.Control

Views: 4739