Finally, I can properly talk about what I’ve been working on for about the last 6 months. The book I’ve been writing is called “C# in Depth” and it’s being published by Manning (just like Groovy in Action was). It’s about C# 2 and 3, and pretty much just C# 2 and 3. In particular, it’s aimed at people who already know C# 1 at least reasonably well. I believe there are plenty of people who are comfortable with C# 1 but either don’t know C# 2 at all or are familiar with it but have gaps in their experience. It’s for these people (hopefully many of whom are reading this blog!) that I’ve been writing.
I don’t know whether there are other books in progress in the same vein. I strongly suspect there will be several books which cover C# from scratch – and end up either skimping on detail, or being unliftable tomes. There may be some books which cover just C# 3 – which will make them less useful for developers who may not get to use C# 3 for a while, or don’t have enough C# 2 experience to fully appreciate C# 3.
Anyway, the first few chapters are now available in MEAP (Manning Early Access Program) at the C# in Depth website. The first chapter is available free, and you can get hold of the others by paying for either the e-book or the hard copy now. Obviously you won’t get the hard copy until it’s published, but you’ll get the electronic version as it gets updated, chapter by chapter. Here’s a quick rundown of the chapters which are available so far:
Chapter 1 – The changing face of C# development
This chapter is mostly introductory material, as you’d expect. There’s an outline and examples of some of the biggest features, a brief history of C# and .NET, and a little look at the “snippet” style of listings used in the rest of the book.
Chapter 2 – Core foundations: building on C#1
Although the rest of the book is written about C# 2 and 3, I wanted to make sure that all the readers had a good understanding of three aspects of C# 1: delegates, value/reference types, and the nature of C#’s type system. While all of them are important in C# 1, they’re often misunderstood – particularly delegates, which aren’t used very often in C# 1 beyond event handling. Delegates are friendlier in C# 2, and understanding C# 3 is practically impossible without a good handle on them.
Chapter 3 – Parameterized typing with generics
Generics are the biggest feature of C# 2, and the biggest change in the .NET 2.0 CLR as well. In this chapter I look at why they’re needed, how to use existing generic types/methods as well as how to write your own. Some more advanced topics are covered such as thinking about what the runtime does with generic types, and I examine the generic collection types provided by .NET 2.0. Finally, I cover some of the limitations of C# generics in C#, including the lack of covariance/contravariance (which is one of the most frequently asked questions in the C# newsgroup).
So, I hope that’s whetted your appetite a bit. Obviously I’d be overjoyed if all of you lovely people bought a copy of the book, but even if you don’t want to part with any cash right now, I’d still appreciate comments. Rather than talking about the book here in my blog, it’s best to use the author forum which has been set up for that very purpose. If you want to keep things private, you can email me directly of course.
Having worked this hard on the book, I reserve the right to plug it on this blog every so often – but I promise not to turn the blog into just a stream of adverts