Is there a way to fetch all the control using linq.
What I’ll like to do is something like that (order the control by tab index) :
foreach (Control control in this.Controls.OrderBy(c => c.TabIndex) { ... }
I use that kind of query when I got a List<…>
I use c# and .Net 3.5
ControlCollectiononly implementsIEnumerable, notIEnumerable<T>. That’s easy to fix though – add a call toCast():Or you could use a query expression, which will call
Cast()where necessary: