When I first picked up C# in Depth I was expecting to be bored. Although I wanted to read it I thought that most of the book will be introductory level C# programming such as you might expect from a book that teaches a single language. I was wrong!
So if you’re looking for a book to learn C# from scratch – look elsewhere on the other hand if you already have some C experience under your belt and you want to learn more – this is the book for you. The book doesn’t waste any time on teaching the basics of C# (i.e. this is a for loop…) instead it takes you through the C# language and explains about how they cam to pass along with a few gotchas.
The book is divided into four parts each focuses on a different version of C# – the 1st part is all about C# 1.x, the 2nd part is about C# 2.0 – you get the point. in each part Jon Skeet helps understand the design decisions that created the current feature set and how each version was built on to of it’s predecessor.
Part1 – Preparing for the journey
The 1st part is made up from two parts, the first is about preparing for the book – C# specifications, using the snippet compiler and so on. the second part is about the beginning of C#delegates, the C# type system, reference and value types and how C# 2 is going to make it all better.
Part 2 – C# 2: solving the issues of C# 1
The 2nd part is where things are getting interesting – Jon shows how the second coming of C# made things easier for developers. I forgot how much syntax I needed to write in order to listen to an event – and now I know why I no longer needs it. Needless the say the big feature of C# 2.0 – generics has most of the focus of this part -along with clear and thorough explanation about how they work. Other feature of C# 2.0 you can find in this part are partial classes (and when to use them), nullable types, static classes to name a few.
Part 3 – C# 3: revolutionizing how we code
The chapters in this part are all about C# 3.0 and 3.5, beginning with the syntactic sugar of auto-properties, object initializers, var and anonymous types going to lambdas and expression trees to extension methods finishing with the reason for most of these features – Linq. I’ve known and used all of these features in the past but this chapter helped me understand them better.
Part 4 – C# 4: playing nicely with others
The new kid on the block – all of the new features for the latest C# to date – optional and names parameters and why you need them (hint: COM). Generics covariance and contravariance that would make you head spin. And other changes
Part 5 – The appendixes
I usually don’t read the appendixes and use them for ad-hoc reference but in this case I kept on reading because they felt like an integral part of the book. There are three of them –
- LINQ standard query operators
- Generic collections in .NET (including the new concurrent collections)
- Version summaries (ok that one you can pass)
To summarize – I enjoyed reading C# in depth, it’s a good book that a c# developer can benefit from and I can’t wait till the third edition comes out – hopefully shortly after C# 5 is released.
One thought on “Book review: C# in Depth, Second Edition”
Understanding any language in deep is quite useful, especially when trying to comprehend why something isn't acting as you predicted. But similarly, knowing how to work with language is important too and I think this book is a perfect solution to this that gives you both, understanding as well as writing knowledge.