I\'m not for sure how the ControlCollection of ASP.Net works, so maybe someone can shed some light on this for me.
I recently discovered the magic that is extension
No, IEnumerable
doesn't have many extension methods on it: IEnumerable
does. They are two separate interfaces, although IEnumerable
extends IEnumerable
.
The normal LINQ ways of converting are to use the Cast
IEnumerable textBoxes = Controls.OfType();
IEnumerable controls = Controls.Cast();
The difference between the two is that OfType
will just skip any items which aren't of the required type; Cast
will throw an exception instead.
Once you've got references to the generic IEnumerable
type, all the rest of the LINQ methods are available.