Reimplementing LINQ to Objects: Part 36 – AsEnumerable
Our last operator is the simplest of all. Really, really simple. What is it? AsEnumerable has a single signature: public static IEnumerable<TSource> AsEnumerable<TSource>(this IEnumerable<TSource> source) I can describe its behaviour pretty easily: it returns source. That’s all it does. There’s no argument validation, it doesn’t create another iterator. It just returns source. You may well be wondering what the point is… and it’s all about changing the compile-time type of the expression. I’m going to take about IQueryable<T> in another post (although probably not implement anything related to it) but hopefully you’re aware that it’s usually used for "out of process" … Continue reading Reimplementing LINQ to Objects: Part 36 – AsEnumerable