It??™s not just expression trees??”we??™ve also relied on the query expression translation
employed by the compiler, and the way that lambda expressions can be converted to
both delegates and expression trees. Extension methods are also important, as without
them each provider would have to give implementations of all the relevant methods. If
12 I??™ve explicitly specified the number of threads in this example to force parallelism even on a single-core system.
If the number of threads isn??™t specified, the system acts as it sees fit, depending on the number of cores
available and how much other work they have.
351 Summary
you look back at all the new features of C#, you??™ll find few that don??™t contribute significantly
to LINQ in some way or other. That is part of the reason for this chapter??™s existence:
to show the connections between all the features.
I shouldn??™t wax lyrical for too long, though??”as well as the upsides of LINQ, we??™ve
seen a few ???gotchas.??? LINQ will not always allow us to express everything we need in a
query, nor does it hide all the details of the underlying data source. The impedance
mismatches that have caused developers so much trouble in the past are still with us:
we can reduce their impact with ORM systems and the like, but without a proper
understanding of the query being executed on your behalf, you are likely to run into
significant issues.
Pages:
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653