Why are there no LINQ extension methods on RepeaterItemCollection despite the fact that it implements IEnumerable?
I’m using Linq to objects elsewhere in the same class. However, when I attempt to do so with the RepeaterItemCollection they aren’t available. I was under the impression that the LINQ extension methods were available to classes that implement IEnumerable.
What am I missing?
It implements
IEnumerable, but notIEnumerable<T>.That doesn’t mean you can’t use it though – that’s part of what
OfTypeandCastare for, building a generic sequence from a nongeneric one:In this case
Castis more appropriate thanOfTypeas you should be confident that it will only containRepeaterItemvalues. Note thatCastis what gets used if you state the type of a range variable in a query expression, so this will work too: