C 5 0 in a Nutshell 5th Edition The Definitive Reference Joseph Albahari 2024 Scribd Download
C 5 0 in a Nutshell 5th Edition The Definitive Reference Joseph Albahari 2024 Scribd Download
com
https://ebookname.com/product/c-5-0-in-a-nutshell-5th-
edition-the-definitive-reference-joseph-albahari/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/c-4-0-in-a-nutshell-the-definitive-
reference-fourth-edition-joseph-albahari/
ebookname.com
https://ebookname.com/product/linq-pocket-reference-pocket-reference-
o-reilly-1st-edition-joseph-albahari/
ebookname.com
https://ebookname.com/product/c-5-0-programmer-s-reference-1st-
edition-rod-stephens/
ebookname.com
https://ebookname.com/product/why-we-play-an-anthropological-study-
roberte-hamayon/
ebookname.com
Selected Readings on Information Technology Management
Contemporary Issues Premier Reference Source 1st Edition
George Kelley
https://ebookname.com/product/selected-readings-on-information-
technology-management-contemporary-issues-premier-reference-
source-1st-edition-george-kelley/
ebookname.com
https://ebookname.com/product/climate-change-and-human-rights-an-
international-and-comparative-law-perspective-1st-edition-ottavio-
quirico/
ebookname.com
https://ebookname.com/product/aggregation-induced-emission-
fundamentals-and-applications-2-volume-set-1st-edition-anjun-qin/
ebookname.com
https://ebookname.com/product/colloquial-vietnamese-the-complete-
course-for-beginners-2nd-edition-bac-hoai-tran/
ebookname.com
Designing for Older Adults Principles and Creative Human
Factors Approaches Second Edition Arthur D. Fisk (Author)
https://ebookname.com/product/designing-for-older-adults-principles-
and-creative-human-factors-approaches-second-edition-arthur-d-fisk-
author/
ebookname.com
www.it-ebooks.info
www.it-ebooks.info
C# 5.0
IN A NUTSHELL
Fifth Edition
www.it-ebooks.info
C# 5.0 in a Nutshell, Fifth Edition
by Joseph Albahari and Ben Albahari
Copyright © 2012 Joseph Albahari and Ben Albahari. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online
editions are also available for most titles (http://my.safaribooksonline.com). For more infor-
mation, contact our corporate/institutional sales department: 800-998-9938 or
[email protected].
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trade-
marks of O’Reilly Media, Inc. C# 5.0 in a Nutshell, the cover image of a numidian crane, and
related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book, and O’Reilly Media,
Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and
authors assume no responsibility for errors or omissions, or for damages resulting from the
use of the information contained herein.
ISBN: 978-1-449-32010-2
[M]
1340210346
www.it-ebooks.info
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
2. C# Language Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
A First C# Program 9
Syntax 12
Type Basics 15
Numeric Types 23
Boolean Type and Operators 30
Strings and Characters 32
Arrays 34
Variables and Parameters 38
Expressions and Operators 47
Statements 51
Namespaces 59
iii
www.it-ebooks.info
3. Creating Types in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Classes 67
Inheritance 80
The object Type 89
Structs 93
Access Modifiers 94
Interfaces 96
Enums 102
Nested Types 105
Generics 106
4. Advanced C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Delegates 119
Events 128
Lambda Expressions 135
Anonymous Methods 139
try Statements and Exceptions 140
Enumeration and Iterators 148
Nullable Types 153
Operator Overloading 158
Extension Methods 162
Anonymous Types 164
Dynamic Binding 165
Attributes 173
Caller Info Attributes (C# 5) 175
Unsafe Code and Pointers 177
Preprocessor Directives 180
XML Documentation 182
iv | Table of Contents
www.it-ebooks.info
Equality Comparison 254
Order Comparison 264
Utility Classes 267
7. Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Enumeration 271
The ICollection and IList Interfaces 279
The Array Class 282
Lists, Queues, Stacks, and Sets 291
Dictionaries 299
Customizable Collections and Proxies 306
Plugging in Equality and Order 312
Table of Contents | v
www.it-ebooks.info
Working with Values 438
Documents and Declarations 441
Names and Namespaces 444
Annotations 450
Projecting into an X-DOM 450
vi | Table of Contents
www.it-ebooks.info
Principles of Asynchrony 573
Asynchronous Functions in C# 5.0 578
Asynchronous Patterns 594
Obsolete Patterns 601
www.it-ebooks.info
The Global Assembly Cache 743
Resources and Satellite Assemblies 745
Resolving and Loading Assemblies 754
Deploying Assemblies Outside the Base Folder 759
Packing a Single-File Executable 760
Working with Unreferenced Assemblies 762
www.it-ebooks.info
Signaling with Event Wait Handles 895
The Barrier Class 903
Lazy Initialization 904
Thread-Local Storage 907
Interrupt and Abort 909
Suspend and Resume 910
Timers 911
Table of Contents | ix
www.it-ebooks.info
Cookbook Regular Expressions 1003
Regular Expressions Language Reference 1006
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011
x | Table of Contents
www.it-ebooks.info
Preface
Intended Audience
This book targets intermediate to advanced audiences. No prior knowledge of C#
is required, but some general programming experience is necessary. For the begin-
ner, this book complements, rather than replaces, a tutorial-style introduction to
programming.
If you’re already familiar with C# 4.0, you’ll find a reorganized section on concur-
rency, including thorough coverage of C# 5.0’s asynchronous functions and its
xi
www.it-ebooks.info
associated types. We also describe the principles of asynchronous programming and
how it helps with efficiency and thread-safety.
This book is an ideal companion to any of the vast array of books that focus on an
applied technology such as WPF, ASP.NET, or WCF. The areas of the language
and .NET Framework that such books omit, C# 5.0 in a Nutshell covers in detail—
and vice versa.
If you’re looking for a book that skims every .NET Framework technology, this is
not for you. This book is also unsuitable if you want to learn about APIs specific to
tablet or Windows Phone development.
xii | Preface
www.it-ebooks.info
Figure P-1. Sample diagram
All code listings for Chapter 2 through Chapter 10, plus the
chapters on concurrency, parallel programming, and dynamic
programming are available as interactive (editable) LINQPad
samples. You can download the whole lot in a single click: go
to LINQPad’s Samples tab at the bottom left, click “Download
more samples,” and choose “C# 5.0 in a Nutshell.”
Preface | xiii
www.it-ebooks.info
Other documents randomly have
different content
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
ANY PURPOSE.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com