15. LINQ with Query Expressions

THE END OF CHAPTER 14 showed a query using standard query operators for GroupJoin(), SelectMany(), and Distinct(), in addition to the creation of two anonymous types. The result was a statement that spanned multiple lines and was fairly complex to comprehend, certainly a lot more complex than statements typically written in C# 2.0, even though it appears fully compatible with C# 2.0 syntax. The introduction of standard query operators facilitated scenarios where such complex statements were desirable even though the resultant code may be complex and hard to read. In addition, the queries which standard query operators implemented were functionally very similar to queries generally implemented in SQL.

The culmination ...

Get Essential C# 4.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.