Title: Pro C# 2010 and the .NET 4 Platform, Fifth Edition
Author : Andrew Troelsen
APress April 2009
Buy from APress
Man Versus Review - Pro C# 2010 and the .NET 4 Platform, Fifth Edition
The first thing I thought when I opened the package from Apress was “Wow, this is going be a challenge”. What Man v. Food host Adam Richman is to large food platters, I am to book reviews. I’ll be doing this in one stint to try and take this big boy down and score a point for ‘Man’, in less than 2 hours.
Weighing in at around 5lbs this book, is heavier than Adam’s Meat topping in his carnivore challenge. I’ve currently got a huge appetite, but will it be big enough for “ Pro C# 2010 and the .NET 4 Platform”. The title set out the challenge ahead, and only one of us will come out the other side. There’s over 1,700 pages, and 34 chapters, in this beast, but the challenge is on.
Chapter 1 – The Philosophy of .NET
The opening chapter releases a whole raft of flavours and tastes, with even a slight bitterness of talk about Java – Life before .NET. we’re then into the crunchiness of the Assemblies, Metadata and the Common Type System (CTS), all sorts of familiar tastes flow, with enumerations, structures, delegates and members – this is only the first bite, so we are still at a high level. We look at Namespaces, and dive into Reflector – this is a well-made meal and I’m hungry for more!
Chapter 2 – Building C# Applications
We’re straight into hello world, but done in NotePad, a great way to explain what’s happening, the raw flavours, without the richness of the Sauce of VS2010 the sample then goes on to look at a tool called SharpDevelop, before the aroma of VS2010 hits the roof of our mouth and we go into overdrive with refactoring, code expansions and the visual class designer.
Chapter 3 – Core C# Programming Constructs
I’m now looking at page 73 and realising the size of the task, it’s pretty daunting and I’ve got a long way to go. We are into the anatomy of a C# application, covering Main() and how to return an error, pass parameters and access/set them up, before moving on to System.Console and formatting its output. We then Savour the richness of the DataTypes and their hierarchy, and taste the power and ranges of each item. The chapter then explores Strongly Typing and the var keyword before covering Iterators and Switch statements.
Chapter 4 – Core C# Programming Concepts Part 2
Chapter 4 dives into methods and Parameter modifiers, the new Optional Parameters in C# 4.0 and invoking methods with named parameters – new flavours, not tasted before. We then move onto C# arrays and the enum type, well covered with good, simple examples. We next move to value and reference types and then Nullable types before finishing on the ?? operator (that’s what I’m beginning to wonder about this challenge already!)
Chapter 5 – Defining Encapsulated Class Types
We’re now into the meat of the c# language with the Class type, like a marinated Pastrami, it tastes good, and well made. We’re now into C# constructors, including the free one, and how it’s silently removed when you add another. We then look at the THIS keyword and the static keyword. Then the pillars of OOP come throug, Encapsulation, Inheritance and Polymorphism. We then look at the C# access modifiers and properties, and C# object initializers, before closing on partial types.
Chapter 6 – Understanding Inheritance and Polymorphism
Inheritance, is where we begin, well laid out, with a sample also demonstrated with the VS2010 Class Designer and the exploring the base constructors. We are then into polymorphism and overriding/shadowing members, before looking at the big man himself – System.Object, and include GetHashCode – something I once found a use for!
Chapter 7 – Understanding Structured Exception Handling
Don’t look at the page numbers, and I’ll be fine. In this chapter we are straight into System.Exception and its properties, and implementing various Custom Exceptions and using VS2010 to debug. It then talks about Corrupted State Exceptions, new to .NET 4.0 before wrapping up this lettuce leaf of a chapter.
Chapter 8 – Understanding Object Lifetime
Now we are creating objects, we need to know when they go away. That’s the subject of Chapter 8 – We look at setting objects to NULL, garbage collection and the differences between Garbage Collection in .NET 1.0 – 3.5 and .NET 4.0, with Background Garbage Collection. We then look at the System.GC Class, which we’ve all played with at one time or another before moving on to Finalizing Objects I thought this was the last taste in my mouth, but there’s a lot more to come in this title, and just Lazy loading in this Chapter.
Chapter 9 – Working with Interfaces
Interfaces, is the filling inside chapter 9, what they are and how they compare to abstract base classes. It then takes us through creating and implementing interfaces, before looking at Enumerable, cloning and comparing interfaces.
Chapter 10 – Generics,
This is a subject to really get your teeth into, explaining the issue, before highlighting the role of generics, in classes, methods and structures.
Chapter 11 – Delegates, events and Lambdas.
I’m struggling at page 396 – no because the book isn’t any good, more that it’s a book crammed full of goodness. It’s certainly for reference, rather than a casual read. In this chapter the book looks at Delegate types, including MultiCastDelegate. It then moves onto events and event parameters, including anonymous methods. The chapter rounds off looking at Lambda Expressions.
Chapter 12 – Advanced C# Language Features
Chapter 12 Covers Indexers, overloads, custom type converters, Partial methods, anonymous types, unsafe and size of keywords.
Chapter 13 – LINQ TO Objects
Blimey, I’m feelling full!. It’s the Wafer thin min of chapters, at only 30+ pages, covering LINQ to objects (LINQ is also covered later in this book – XML Chapter25, Parallel LINQ Chapter 19, and also LINQ to Entities – Chapter 23)
What’s that ringing noise? The ringing of the bell means I’m out of time, crashed and burned. In a way, it’s a good testament to the book that I kinda got lost in reading it, rather than just reviewing it quickly. I’ve certainly still got an appetite for this book; it’s just that the clock has beaten me. Score +1 for the book. I only got to Chapter 13 out of 34!
Post Review Interview
Q: Rich, Would you recommend the book?
A: Absolutely, it’s not light reading, but as a reference manual it covers a lot of ground – Chapters 1- 20 are all Core C# stuff, and then Chapters 21-34 cover all the associated technologies, such as ADO.NET, WPF, WCF, ASP.NET. Don’t carry it around with you though.
Q: What was your strategy for the review?
A: I set out to cover the first few chapters in depth and get a good feel for the book, this took me too long. I also tried not to drop it on my foot.
Q: Final Thoughts?
A: Pro C# 2010 and the .NET 4.0 Platform is a huge title, and a comprehensive one at that, it covers an extraordinary amount of ground in depth, which is quite some achievement. It’s sheer size, could be off putting for a new developer, but it’ll really help them get upto speed on this expansive technology. Oh and 2 hours is not enough time to review a book!