Using LINQ for an object that only has GetEnumerator()

The existing Linq extension methods work on objects that implement IEnumerable<T>. I assume your object implements the non-generic IEnumerable interface. In that case you can use the Cast<T> extension method to get a generic IEnumerable<T> wrapper. For instance, if the elements are of type int :

var wrapper = myObject.Cast<int>();

You can now use Linq on the wrapper

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)