Chapter 8. Cutting fluff with a smart compiler

This chapter covers

  • Automatically implemented properties
  • Implicitly typed local variables
  • Object and collection initializers
  • Implicitly typed arrays
  • Anonymous types

We’ll start looking at C# 3 in the same way that we finished looking at C# 2—with a collection of relatively simple features. These are just the first small steps on the path to LINQ. Each of them can be used outside that context, but almost all are important for simplifying code to the extent that LINQ requires in order to be effective.

One important point to note is that although two of the biggest features of C# 2—generics and nullable types—required CLR changes, there were no significant changes to the CLR that shipped with ...

Get C# in Depth, Third Edition now with O’Reilly online learning.

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