What are expressions?
C# 3.0 was introduced in late 2007, and its killer feature was something called Language-Integrated Query (LINQ). With the underlying API model and combination of new capabilities in C#, it introduced a programming paradigm that bridges into the more functional programming space. The fluent interfaces and its use of lambdas can feel foreign if you’re used to more object-oriented approaches.
What it brought to the table was a way of expressing queries for data in a more natural native C# way. Not only does it do this for your in-memory collections, but also for any other data source, such as a database. It basically gave developers a uniform way of expressing queries, filters, and projections.
It did this by recognizing that a query operation consists of the following three distinct parts:
- The data source
- The query expression
- Executing the query
Let’s look at an example without LINQ and compare it to how you could do the...