C# Version 3.0 | |
Released November, 2007 | |
C# version 3.0 came in late 2007, along with Visual Studio 2008, though the full boat of language features would actually come with .NET Framework version 3.5. This version marked a major change in the growth of C#. It established C# as a truly formidable programming language. Let's take a look at some major features in this version: | |
Auto-implemented properties | |
Anonymous types | |
Query expressions | |
Lambda expressions | |
Expression trees | |
Extension methods | |
Implicitly typed local variables | |
Partial methods | |
Object and collection initializers | |
In retrospect, many of these features seem both inevitable and inseparable. They all fit together strategically. It's thought that C# version's killer feature was the query expression, also known as Language-Integrated Query (LINQ). | |
A more nuanced view examines expression trees, lambda expressions, and anonymous types as the foundation upon which LINQ is constructed. But, in either case, C# 3.0 presented a revolutionary concept. C# 3.0 had begun to lay the groundwork for turning C# into a hybrid Object-Oriented / Functional language. | |
Specifically, you could now write SQL-style, declarative queries to perform operations on collections, among other things. Instead of writing a for loop to compute the average of a list of integers, you could now do that as simply as list.Average(). The combination of query expressions and extension methods made a list of integers a whole lot smarter |