In part 1 we took a quick look at a few of the features of C# 2. Now it’s time to do the job properly. We’ll see how C# 2 fixes various problems that developers ran into when using C# 1, and how C# 2 makes existing features more useful by streamlining them. This is no mean feat, and life with C# 2 is much more pleasant than with C# 1.
The new features in C# 2 have a certain amount of independence. That’s not to say they’re not related at all; many of the features are based on—or at least interact with—the massive contribution that generics make to the language. But the different topics we’ll look at in the next five chapters don’t combine into one “super feature.”
The first four chapters of this part cover the biggest new features. We’ll look at the following:
Having covered the major, complex new features of C# 2 with a chapter dedicated to each one, chapter 7 rounds off our coverage by introducing several simpler features. Simpler doesn’t necessarily mean less useful: partial types in particular are crucial for better designer support in versions of Visual Studio from 2005 onward. The same feature is beneficial for other generated code, too. Likewise many C# developers take the ability to write a property with a public getter and a private setter for granted these days—but it was only introduced in C# 2.
When the first edition of this book was published, many developers still hadn’t used C# 2 at all. My impression in 2010 is that it’s rare to find someone who’s currently using C#, but hasn’t at least dabbled with C# 2 and probably 3. The topics covered here are fundamental to how C# 3 and 4 work; in particular, attempting to learn about LINQ without understanding generics and iterators would be tricky. If you’ve been using C# 2 and upward for a while, you may find a lot of this part covers familiar ground—but I suspect you’ll still benefit from a deeper knowledge of the details presented.
3.135.216.75