Buy new:
$22.90$22.90
$3.99
delivery:
March 26 - 27
Ships from: GreenIceMedia Sold by: GreenIceMedia
Buy used: $2.41

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the authors
OK
C# 4.0 in a Nutshell: The Definitive Reference 4th Edition
There is a newer edition of this item:
Purchase options and add-ons
What people are saying about C# 4.0 in a Nutshell
"C# 4.0 in a Nutshell is one of the few books I keep on my desk as a quick reference. It is a book I recommend." --Scott Guthrie, Corporate Vice President, .NET Developer Platform, Microsoft Corporation
"A must-read for a concise but thorough examination of the parallel programming features in the .NET Framework 4." --Stephen Toub, Parallel Computing Platform Program Manager, Microsoft
"This wonderful book is a great reference for developers of all levels." -- Chris Burrows, C# Compiler Team, Microsoft
When you have questions about how to use C# 4.0 or the .NET CLR, this highly acclaimed bestseller has precisely the answers you need. Uniquely organized around concepts and use cases, this fourth edition includes in-depth coverage of new C# topics such as parallel programming, code contracts, dynamic programming, security, and COM interoperability. You'll also find updated information on LINQ, including examples that work with both LINQ to SQL and Entity Framework. This book has all the essential details to keep you on track with C# 4.0.
- Get up to speed on C# language basics, including syntax, types, and variables
- Explore advanced topics such as unsafe code and preprocessor directives
- Learn C# 4.0 features such as dynamic binding, type parameter variance, and optional and named parameters
- Work with .NET 4's rich set of features for parallel programming, code contracts, and the code security model
- Learn .NET topics, including XML, collections, I/O and networking, memory management, reflection, attributes, security, and native interoperability
- ISBN-100596800959
- ISBN-13978-0596800956
- Edition4th
- PublisherO'Reilly Media
- Publication dateMarch 9, 2010
- LanguageEnglish
- Dimensions6 x 2.18 x 9 inches
- Print length1043 pages
Popular titles by this author
Editorial Reviews
About the Author
Joseph is currently a freelance consultant.
Joseph's Home Page
Ben Albahari is the founder of Take On It. He was a Program Manager at Microsoft for 5 years, where he worked on several projects, including the .NET Compact Framework and ADO.NET.
He was the cofounder of Genamics, a provider of tools for C# and J++ programmers, as well as software for DNA and protein sequence analysis. He is a co-author of C# Essentials, the first C# book from O'Reilly, and of previous editions of C# in a Nutshell.
Product details
- Publisher : O'Reilly Media; 4th edition (March 9, 2010)
- Language : English
- Paperback : 1043 pages
- ISBN-10 : 0596800959
- ISBN-13 : 978-0596800956
- Item Weight : 3.15 pounds
- Dimensions : 6 x 2.18 x 9 inches
- Best Sellers Rank: #4,760,759 in Books (See Top 100 in Books)
- #477 in Visual Basic Programming (Books)
- #1,048 in C# Programming (Books)
- #1,109 in Microsoft .NET
- Customer Reviews:
Important information
To report an issue with this product or seller, click here.
About the authors
Joe Albahari is the inventor of LINQPad and an O'Reilly author. He's published 15 books with O'Reilly, including C# 9.0 in a Nutshell and C# 9.0 Pocket Reference, and speaks regularly at user groups and conferences such as NDC and YOW. Joe has been a C# MVP since 2008.
Ben Albahari is currently involved in the bioinformatics business. He was a Program Manager at Microsoft for 5 years, where he worked on several projects, including the .NET Compact Framework and ADO.NET. He was the co-founder of Genamics, a provider of tools for C# and J++ programmers, as well as software for DNA and protein sequence analysis.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
The level of the book ranges from intermediate (C#, part of the discussion of LINQ, regular expressions, etc.) to quite advanced (locks, parallel programming, SpinWait, reflection).
As an experienced C++ and Windows developer with some exposure to Java and COM, I found the chapters on LINQ and parallel programming the most rewarding. The debt to Java is clear, but there is much more besides. Of course I miss not having pointers, but there are many benefits to working in a framework that has well-crafted comprehensive solutions that make networking, multithreading, database queries, etc., easier.
Readers should download the code samples from [...](albahari.com/nutshell/predicatebuilder.aspx)
as well as the more extensive C# sample code from
[...](msdn.microsoft.com/en-us/library/aa287464(v=vs.71).aspx)
I also recommend downloading the full-scale application available at
[...](A-Generic-Reusable-Diff-Algorithm-in-C#, CodeProject)
(if these links are broken, just Google.)
Finally, readers will want to download LinqPad from the authors' website. That's fine, but you should also load the samples into Visual Studio and modify them to compile and run from the VS IDE (you will need to add appropriate references to the project, which gives good practice in discovering where things are in the framework). Tweak the code in the VS IDE and see what happens -- you may be surprised!
There is no fat or padding in this book and you will need to consult your on-line help for details about options, signatures, etc. Instead, the authors focus on the most productive programming patterns for solving the important practical problems that arise again and again in seemingly countless guises. They share a great many insights and tips in the bear-track and bear-trap sidebars and you should make every effort to understand them in detail.
In doing this, you may find yourself going off the deep end here and there. This happened to me in the discussion of Thread.MemoryBarrier and the volatile keyword. Many questions arise here that the authors don't go into, and a fully satisfactory treatment of memory barriers demands a discussion of their hardware implementation. As I understand it, a memory barrier ensures that no memory access before/after the barrier can be moved so that it occurs after/before it. A variable marked volatile cannot be cached, either into a register or into the secondary (level-2) cache -- how does this relate to acquire and release fences? The error exposed in the example class IfYouThinkYouUnderstandVolatile is difficult to reproduce. Apparently, there is no way (Parallel.Invoke fails, for example) to arrange for two threads to execute Test1 and Test2 exactly simultaneously in parallel on my quad-core i5 processor, and without this such an event in the wild would be too rare to show up in practical test runs. So you'd have to look at the IL code (release build with optimizations), but I can find no reordering on my machine. Still, it's possible the just-in-time (JIT) compiler might reorder the IL instructions, and special tools would be needed to catch that. It seems the authors here are holding out their little pinky to the devil, but he wants more. The take-away, which the authors recommend, is just to stick with locks.
This is one of the very best programming books, in a class with Pietrek's "Windows 95 System Programming Secrets" and Richter's "Advanced Windows Programming".
This book is amazing for the clarity of the presentation. Each chapter is obviously well thought out, almost like a well designed program itself. You can read through a chapter and come away with a complete understanding of all the various concepts, alternatives, and syntax usage examples. In most cases the author will also briefly discuss why you may not want to use a specific construct over another one.
The Parallel Programming chapter covers .Net 4 parallel programming in a way I have never seen before. Now I get it. With the other articles and blogs I had read it seemed like it was just new ways of controlling locks, it is not. There are new objects to help you do things the old way, but there are also new ways to do things.
I bought this book based upon the strength of his C# 3 book, and I think this book has to be of even higher quality than the previous. I ordered copies for every programmer who works for me today. It will be one of the few .Net books that I keep as a reference.
All the examples have the right size (I don't want to pay for something I can download), maybe with the idea that the reader uses LINQPad to replay and really this app it's a good companion for the book.
The writer's style is friendly (yet for someone that don't speak english, like myself).
And because you WANT a C# reference: this book haven't a single word about ASP or ADO... ;-)
Some points I wish to change:
Perhaps a little more space for dynamic programming
The book's format (OReilly's standard I think) it's not very comfortable for me, I prefer others sizes like Wrox or MSPress, but it's not assignable to the book but to the editorial.
One of the bast aspects of the book is its LINQ coverage. The authors make available a downloadable LINQ utility called LINQPad, which is very useful for developing LINQ queries. The program contains most of the LINQ examples from the book, which makes it a particularly valuable learning tool. I dodged LINQ when it was released several years ago, because it's documentation was so bad. I am using C# 4.0 in a Nutshell to learn it, and I am very impressed by both the book and LINQ.
Top reviews from other countries



Es liefert in-depth Informationen zu C# und der CLR bzw. dem .NET Framework, sowohl theoretischer Art als auch mit vielen aussagekräftigen Beispielen. Der Stil ist prägnant, auf das wesentliche konzentriert, kein Ausufern und dennoch umfassend und sehr gut verständlich.
Das Buch kommt auf einen Umfang von rund 1000 Seiten, der aber nicht abschrecken sollte. Einzelne Themenbereiche werden abgeschlossen behandelt, falls nötig die Referenzen zu anderen Kapiteln angeführt, sowie Tipps oder eventuelle "Fallen" angeführt. So kann man sich in ein Thema vertiefen ohne das gesamte Buch gelesen haben zu müssen und auf jeden Fall Gewinn daraus ziehen.
Ich selbst ertappe mich dabei, dass ich "schnell etwas nachschlagen" will, und dann am Thema hängenbleibe und mehr lese als ich ursprünglich vorhatte, sogar zum Zwischendurch-Lesen nehme ich das Buch zur Hand, es liest sich für mich fast wie ein guter Roman - vielleicht ticke ich aber auch zu sehr C# :-)
Beispiele, Kapitel die ich zuerst gelesen habe, und die mich sofort für das Buch gewonnen haben:
- Serialization: Engines, Performancevergleich, DeepClone und referenzielle Integrität von Objektbäumen bewahren
- Framework Fundamentals/Equality Comparison
- Disposal & Garbage Collection/Managed Memory Leaks
Ich denke, dass es kaum einen C# Entwickler gibt, der nicht von diesem Buch profitieren würde. Immer im Kopf behalten, dass es hier um eine Referenz geht, und keine Einführung in OO-Programmierung mit C# oder ähnliches. Ich schreibe aus der Sicht eines langjähren .NET Entwicklers.

Even seasoned programmers will learn a lot from this book, and newcomers to C# will find all they need.
If I were to criticise it at all, it would be in the chapter on reflection. Not that there's anything wrong with this chapter, but like every other source on the subject I've read, it leaves me wondering why I would bother with it. I have heard of people who use reflection for all sorts of clever things, and I would love to know what and how, but have never found out. This book covers reflection in a clear manner, but didn't give me any great incentive for using it. That could be more a reflection (pun intended) on the subject rather than a criticism of the book.
As I said, this is a small criticism, and the number of tips and tricks I picked up in the other chapters more than made up for the lack of anything exciting in that one chapter.
However, even without the small gems in the familiar subjects, one of this book's real diamonds is the section on Linq. I've read a lot about it, and used it a lot, but never really understood it until I read this book. Together with the free LinqPad (written by one of the authors), it's a brilliant way to learn a very useful tool.
I haven't finished the book yet, but am happy to give it five stars even now. Strongly recommended.
Edit: 15th May '11 - Having finished the book, I still stand by my five star review, but would like to add that there is a very comprehensive set of chapters on parallel programming in C#. Given that I don't tend to write compute-intensive applications, this is of little interest to me, and I found it a bit boring after the first chapter. I just skipped it and skim-read the rest, taking mental note of the fact that it was there if I ever need it.
To be honest, I think this section should have been shorter, and the depth of material put into a book dedicated to parallel programming. However, given that the rest of the book was excellent, and the price was reasonable (so no complaints about being charged a lot for pages I wasn't interested in), I left it as a five start review, and just added this note.

Es ist allerdings nicht für Anfänger im Programmieren allgemein geschrieben. Grundkenntnisse sollten vorhanden sein. Hat man diese, ist das Buch einfach nur noch ein Genuss. Sonst oft nur spärlich behandelte Themen wie Multithreading/Parallele Programmierung kommen hier voll auf ihre kosten. Anstatt Grundlagen bis ins letzte Detail durch zu kauen und hunderte Seiten für GUI Programmierung mit Bildern zu verschwenden, scheint der Author sich bei jedem einzelnen Satz gut überlegt zu haben ob man ihn braucht und was er dem Leser bringen soll. Sprich: Das Buch ist trotz seiner 1000 Seiten keinsfalls überladen oder liest sich zäh. Im Gegenteil, es ist als würde man einen spannenden Roman lesen. Und die Beispiele sind so simpel als möglich und so kompliziert wie nötig gehalten. Sprich: Sie sind kurz und auf den Punkt gebracht.
Also von mir, eine uneingeschränkte Kaufempfehlung. Ich arbeite selbst als Softwareentwickler und das Buch lohnt sich wirklich (außer für absolute Neulinge im Programmieren, wo es evtl. noch ein overkill ist).