👨‍🚀💬

Using Regex and Yield to Recursively Find Multiple Controls

This is a simple extension method that finds all child controls whose ID matches the regex pattern.

The Code

Demonstration

foreach (Control control in pnlExample.FindControlsRecursive(@"[^QuestionID]"))
{
    // do something
}

~ posted in professional on 06.08.2011