I
don??™t wish to sound like a mindless and noncritical C# devotee, but I feel there??™s
something special in C# 3.
With that brief burst of abstract admiration out of the way, let??™s start looking at
C# 3 in a more concrete manner.
207
Cutting fluff
with a smart compiler
We 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, however. Each of them can be used outside that context, but they??™re
all pretty important for simplifying code to the extent that LINQ requires in order
to be effective.
One important point to note is that while two of the biggest features of C# 2??”
generics and nullable types??”required CLR changes, there are no significant
changes to the CLR that ships with .NET 3.5. There are some bug fixes, but nothing
fundamental. The framework library has grown to support LINQ, along with introducing
a few more features to the base class library, but that??™s a different matter. It??™s
This chapter covers
?– Automatically implemented properties
?– Implicitly typed local variables
?– Object and collection initializers
?– Implicitly typed arrays
?– Anonymous types
208 CHAPTER 8 Cutting fluff with a smart compiler
worth being quite clear in your mind which changes are only in the C# language,
which are library changes, and which are CLR changes.
Pages:
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401