Chapter 14. C# Language Enhancements
WHAT YOU WILL LEARN IN THIS CHAPTER
How to use initializers
What the
var
type is and how to use type inferenceHow to use anonymous types
What the
dynamic
type is and how to use itHow to use named and optional method parameters
How to use extension methods
What lambda expressions are and how to use them
The C# language is not static. Anders Hejlsberg (the inventor of C#) and others at Microsoft continue to update and refine the language. At the time of this writing, the most recent changes are part of version 4 of the C# language, which is released as part of the Visual Studio 2010 product line. At this point in the book you may be wondering what else could be needed; indeed, previous versions of C# lack little in terms of functionality. However, this doesn't mean that it isn't possible to make some aspects of C# programming easier, or that the relationships between C# and other technologies can't be streamlined.
Perhaps the best way to understand this is to consider an addition that was made between versions 1.0 and 2.0 of the language—generics. You could argue that while generics are extremely useful, they don't actually provide any functionality that you couldn't achieve before. True, they simplify things a great deal, and you would have to write a lot more code without them. None of us would want to go back to the days before generic collection classes. Nonetheless, generics aren't an essential part of C#. They are, though, a definite improvement ...
Get Beginning Visual C# 2010 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.