LINQ to Objects Overview

Part of what makes LINQ so cool and easy to use is the way it so seamlessly integrates with the C# language. Instead of having an entirely new cast of characters in the form of classes that must be used to get the benefits of LINQ, you can use all of the same collections[] and arrays that you are accustomed to with your preexisting classes. This means you can gain the advantages of LINQ queries with little or no modification to existing code. The functionality of LINQ to Objects is accomplished with the IEnumerable<T> interface, sequences, and the Standard Query Operators.

[] A collection must implement IEnumerable<T> or IEnumerable to be queryable with LINQ.

For example, if you have an array of integers and need it to be sorted, you can perform a LINQ query to order the results, much as if it were a SQL query. Maybe you have an ArrayList of Customer objects and need to find a specific Customer object. If so, LINQ to Objects is your answer.

I know there will be a tendency by many to use the LINQ to Objects chapters as a reference. While I have made significant effort to make them useful for this purpose, the developer will gain more by reading them from beginning to end. Many of the concepts that apply to one operator apply to another operator. While I have tried to make each operator's section independently stand on its own merit, there is a context created when reading from beginning to end that will be missed when just reading about a single operator or skipping around.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset