A Paradigm Shift

Did you just feel your world shift? As a .NET developer, you should have. With the trivial programming example in Listing 1-1, you just ran what somewhat appears to be a Structured Query Language (SQL) query on an array of strings.[] Check out that where clause. If it looks like I used the EndsWith method of a string object, it's because I did. You may be wondering what is with that variable type var? Is C# still performing static type checking? The answer is yes, it still statically checks types at compile time. What feature or features of C# are allowing all of this? The answer is Microsoft's Language Integrated Query, otherwise known as LINQ.

[] Most noticeably, the order is inverted from typical SQL. Additionally, there is ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.