Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
LINQ to Objects has many operators that facilitate casting elements in a sequence and the sequence itself. This is often necessary to access specific instance methods that occur in one collection type from another or to access an instance property of an element.
The AsEnumerable operator changes the compile time type of the source sequence, casting a sequence or collection back to System.Collections.Generic.IEnumerable<T>. This allows control over what LINQ provider will be called and used extensively when choosing between LINQ providers—most commonly at this time when choosing to execute part of a LINQ to SQL query in-memory rather than at the database. This technique is demonstrated in Chapter 9, where it is used to segment queries into sequential and parallel implementations.