I have created a base user control (BaseUserControl) class that is implemented by all my user controls. In that class I have a property that contains a collection of JavaScript URL references. What is the best way to parse a page for that type of user control?
I experimented using LINQ, but I don’t think I can query the Controls collection with it:
var controls = (from c in page.Controls where c is BaseUserControl)
foreach(control in controls){
var javascript = control.JavaScriptReference
}
The slightly more idiomatic way to do that would be to use Enumerable.OfType.