C# 4.0 in a Nutshell: The Definitive Reference [NOOK Book]


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 ...

See more details below
C# 4.0 in a Nutshell: The Definitive Reference

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 42%)$39.99 List Price


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
Read More Show Less

Product Details

  • ISBN-13: 9781449382926
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/20/2010
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 4
  • Pages: 1060
  • File size: 8 MB

Meet the Author

Joseph Albahari is author of C# 3.0 in a Nutshell, LINQ Pocket Reference, and C# 3.0 Pocket Reference. He has been developing large-scale enterprise applications on .NET and other platforms for more than 15 years, and is author of LINQPad - the popular utility for querying databases in LINQ.

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.

Read More Show Less

Table of Contents

Intended Audience;
How This Book Is Organized;
What You Need to Use This Book;
Conventions Used in This Book;
Using Code Examples;
We’d Like to Hear from You;
Safari® Books Online;
Chapter 1: Introducing C# and the .NET Framework;
1.1 Object Orientation;
1.2 Type Safety;
1.3 Memory Management;
1.4 Platform Support;
1.5 C#’s Relationship with the CLR;
1.6 The CLR and .NET Framework;
1.7 What’s New in C# 4.0;
Chapter 2: C# Language Basics;
2.1 A First C# Program;
2.2 Syntax;
2.3 Type Basics;
2.4 Numeric Types;
2.5 Boolean Type and Operators;
2.6 Strings and Characters;
2.7 Arrays;
2.8 Variables and Parameters;
2.9 Expressions and Operators;
2.10 Statements;
2.11 Namespaces;
Chapter 3: Creating Types in C#;
3.1 Classes;
3.2 Inheritance;
3.3 The object Type;
3.4 Structs;
3.5 Access Modifiers;
3.6 Interfaces;
3.7 Enums;
3.8 Nested Types;
3.9 Generics;
Chapter 4: Advanced C#;
4.1 Delegates;
4.2 Events;
4.3 Lambda Expressions;
4.4 Anonymous Methods;
4.5 try Statements and Exceptions;
4.6 Enumeration and Iterators;
4.7 Nullable Types;
4.8 Operator Overloading;
4.9 Extension Methods;
4.10 Anonymous Types;
4.11 Dynamic Binding;
4.12 Attributes;
4.13 Unsafe Code and Pointers;
4.14 Preprocessor Directives;
4.15 XML Documentation;
Chapter 5: Framework Overview;
5.1 The CLR and Core Framework;
5.2 Applied Technologies;
Chapter 6: Framework Fundamentals;
6.1 String and Text Handling;
6.2 Dates and Times;
6.3 Dates and Time Zones;
6.4 Formatting and Parsing;
6.5 Standard Format Strings and Parsing Flags;
6.6 Other Conversion Mechanisms;
6.7 Globalization;
6.8 Working with Numbers;
6.9 Enums;
6.10 Tuples;
6.11 The Guid Struct;
6.12 Equality Comparison;
6.13 Order Comparison;
6.14 Utility Classes;
Chapter 7: Collections;
7.1 Enumeration;
7.2 The ICollection and IList Interfaces;
7.3 The Array Class;
7.4 Lists, Queues, Stacks, and Sets;
7.5 Dictionaries;
7.6 Customizable Collections and Proxies;
7.7 Plugging in Equality and Order;
Chapter 8: LINQ Queries;
8.1 Getting Started;
8.2 Fluent Syntax;
8.3 Query Expressions;
8.4 Deferred Execution;
8.5 Subqueries;
8.6 Composition Strategies;
8.7 Projection Strategies;
8.8 Interpreted Queries;
8.9 LINQ to SQL and Entity Framework;
8.10 Building Query Expressions;
Chapter 9: LINQ Operators;
9.1 Overview;
9.2 Filtering;
9.3 Projecting;
9.4 Joining;
9.5 Ordering;
9.6 Grouping;
9.7 Set Operators;
9.8 The Zip Operator;
9.9 Conversion Methods;
9.10 Element Operators;
9.11 Aggregation Methods;
9.12 Quantifiers;
9.13 Generation Methods;
Chapter 10: LINQ to XML;
10.1 Architectural Overview;
10.2 X-DOM Overview;
10.3 Instantiating an X-DOM;
10.4 Navigating and Querying;
10.5 Updating an X-DOM;
10.6 Working with Values;
10.7 Documents and Declarations;
10.8 Names and Namespaces;
10.9 Annotations;
10.10 Projecting into an X-DOM;
Chapter 11: Other XML Technologies;
11.1 XmlReader;
11.2 XmlWriter;
11.3 Patterns for Using XmlReader/XmlWriter;
11.4 XmlDocument;
11.5 XPath;
11.6 XSD and Schema Validation;
11.7 XSLT;
Chapter 12: Disposal and Garbage Collection;
12.1 IDisposable, Dispose, and Close;
12.2 Automatic Garbage Collection;
12.3 Finalizers;
12.4 How the Garbage Collector Works;
12.5 Managed Memory Leaks;
12.6 Weak References;
Chapter 13: Diagnostics and Code Contracts;
13.1 Conditional Compilation;
13.2 Debug and Trace Classes;
13.3 Code Contracts Overview;
13.4 Preconditions;
13.5 Postconditions;
13.6 Assertions and Object Invariants;
13.7 Contracts on Interfaces and Abstract Methods;
13.8 Dealing with Contract Failure;
13.9 Selectively Enforcing Contracts;
13.10 Static Contract Checking;
13.11 Debugger Integration;
13.12 Processes and Process Threads;
13.13 StackTrace and StackFrame;
13.14 Windows Event Logs;
13.15 Performance Counters;
13.16 The Stopwatch Class;
Chapter 14: Streams and I/O;
14.1 Stream Architecture;
14.2 Using Streams;
14.3 Stream Adapters;
14.4 File and Directory Operations;
14.5 Memory-Mapped Files;
14.6 Compression;
14.7 Isolated Storage;
Chapter 15: Networking;
15.1 Network Architecture;
15.2 Addresses and Ports;
15.3 URIs;
15.4 Request/Response Architecture;
15.5 HTTP-Specific Support;
15.6 Writing an HTTP Server;
15.7 Using FTP;
15.8 Using DNS;
15.9 Sending Mail with SmtpClient;
15.10 Using TCP;
15.11 Receiving POP3 Mail with TCP;
Chapter 16: Serialization;
16.1 Serialization Concepts;
16.2 The Data Contract Serializer;
16.3 Data Contracts and Collections;
16.4 Extending Data Contracts;
16.5 The Binary Serializer;
16.6 Binary Serialization Attributes;
16.7 Binary Serialization with ISerializable;
16.8 XML Serialization;
Chapter 17: Assemblies;
17.1 What’s in an Assembly?;
17.2 Strong Names and Assembly Signing;
17.3 Assembly Names;
17.4 Authenticode Signing;
17.5 The Global Assembly Cache;
17.6 Resources and Satellite Assemblies;
17.7 Resolving and Loading Assemblies;
17.8 Deploying Assemblies Outside the Base Folder;
17.9 Packing a Single-File Executable;
17.10 Working with Unreferenced Assemblies;
Chapter 18: Reflection and Metadata;
18.1 Reflecting and Activating Types;
18.2 Reflecting and Invoking Members;
18.3 Reflecting Assemblies;
18.4 Working with Attributes;
18.5 Dynamic Code Generation;
18.6 Emitting Assemblies and Types;
18.7 Emitting Type Members;
18.8 Emitting Generic Methods and Types;
18.9 Awkward Emission Targets;
18.10 Parsing IL;
Chapter 19: Dynamic Programming;
19.1 The Dynamic Language Runtime;
19.2 Numeric Type Unification;
19.3 Dynamic Member Overload Resolution;
19.4 Implementing Dynamic Objects;
19.5 Interoperating with Dynamic Languages;
Chapter 20: Security;
20.1 Permissions;
20.2 Code Access Security (CAS);
20.3 Allowing Partially Trusted Callers;
20.4 The Transparency Model in CLR 4.0;
20.5 Sandboxing Another Assembly;
20.6 Operating System Security;
20.7 Identity and Role Security;
20.8 Cryptography Overview;
20.9 Windows Data Protection;
20.10 Hashing;
20.11 Symmetric Encryption;
20.12 Public Key Encryption and Signing;
Chapter 21: Threading;
21.1 Threading’s Uses and Misuses;
21.2 Getting Started;
21.3 Thread Pooling;
21.4 Synchronization;
21.5 Locking;
21.6 Thread Safety;
21.7 Nonblocking Synchronization;
21.8 Signaling with Event Wait Handles;
21.9 Signaling with Wait and Pulse;
21.10 The Barrier Class;
21.11 The Event-Based Asynchronous Pattern;
21.12 BackgroundWorker;
21.13 Interrupt and Abort;
21.14 Safe Cancellation;
21.15 Lazy Initialization;
21.16 Thread-Local Storage;
21.17 Reader/Writer Locks;
21.18 Timers;
Chapter 22: Parallel Programming;
22.1 Why PFX?;
22.2 PLINQ;
22.3 The Parallel Class;
22.4 Task Parallelism;
22.5 Working with AggregateException;
22.6 Concurrent Collections;
22.7 SpinLock and SpinWait;
Chapter 23: Asynchronous Methods;
23.1 Why Asynchronous Methods Exist;
23.2 Asynchronous Method Signatures;
23.3 Asynchronous Methods Versus Asynchronous Delegates;
23.4 Using Asynchronous Methods;
23.5 Asynchronous Methods and Tasks;
23.6 Writing Asynchronous Methods;
23.7 Fake Asynchronous Methods;
23.8 Alternatives to Asynchronous Methods;
Chapter 24: Application Domains;
24.1 Application Domain Architecture;
24.2 Creating and Destroying Application Domains;
24.3 Using Multiple Application Domains;
24.4 Using DoCallBack;
24.5 Monitoring Application Domains;
24.6 Domains and Threads;
24.7 Sharing Data Between Domains;
Chapter 25: Native and COM Interoperability;
25.1 Calling into Native DLLs;
25.2 Type Marshaling;
25.3 Callbacks from Unmanaged Code;
25.4 Simulating a C Union;
25.5 Shared Memory;
25.6 Mapping a Struct to Unmanaged Memory;
25.7 COM Interoperability;
25.8 Calling a COM Component from C#;
25.9 Embedding Interop Types;
25.10 Primary Interop Assemblies;
25.11 Exposing C# Objects to COM;
Chapter 26: Regular Expressions;
26.1 Regular Expression Basics;
26.2 Quantifiers;
26.3 Zero-Width Assertions;
26.4 Groups;
26.5 Replacing and Splitting Text;
26.6 Cookbook Regular Expressions;
26.7 Regular Expressions Language Reference;
C# Keywords;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Posted March 7, 2011

    Solid Reference Book on C# 4.0

    This is a good solid reference book on C# 4.0. Don't get the book expecting a teaching tool. It is a reference book as the title states and for that it is very good. Short concise articles on various aspects of C#. Great as a reminder or an introduction into the subject matter. I would not say this book is for a beginner, even as a reference. The sections are not long enough to fully understand a concept without some previous knowledge. One of the uses I find, is to flip open the book and read up on a section that I don't normally utilize on a daily basis.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)