Currently I am trying to extract a collection of dynamically created controls (checkboxes and dropdownlists) from a recursive control collection (repeater). This is the cod
Change it to
var c = control as T; if (c != null) resultCollection.Add(c);
This will be faster than your cod, since it doesn't call GetType(). Note that it will also add controls that inherit T.
GetType()
T
You'll also need to constrain the type parameter by adding where T : Control.
where T : Control