When you need answers for programming with C# 5.0, this practical and tightly focused book tells you exactly what you need to know—without long introductions or bloated samples. Easy to browse, it’s ideal as quick reference or as a guide to get you rapidly up to speed if you already know Java, C++, or an earlier version of C#. Written by the authors of C# 5.0 in a Nutshell, this book covers the entire C# 5.0 language, including: * All of C#’s fundamentals * Advanced topics such as operator overloading, type constraints, covariance & contravariance, iterators, nullable types, operator lifting, lambda expressions & closures * LINQ, starting with sequences, lazy execution and standard query operators, and finishing with a complete reference to query expressions * Dynamic binding and C# 5.0’s new asynchronous functions * Unsafe code & pointers, custom attributes, preprocessor directives, and XML documentation Table of Contents......Page 7 C# 5.0 Pocket Reference......Page 9 Using Code Examples......Page 10 Safari® Books Online......Page 11 A First C# Program......Page 12 Compilation......Page 15 Identifiers and Keywords......Page 16 Avoiding conflicts......Page 17 Literals, Punctuators, and Operators......Page 18 Predefined Type Examples......Page 19 Custom Type Examples......Page 20 Symmetry of predefined types and custom types......Page 21 Instance versus static members......Page 22 Conversions......Page 23 Value types......Page 24 Reference types......Page 25 Null......Page 26 Predefined Type Taxonomy......Page 27 Numeric Types......Page 28 Numeric suffixes......Page 29 Real to integral conversions......Page 30 Integral overflow......Page 31 Bitwise operators......Page 32 Special Float and Double Values......Page 33 Real Number Rounding Errors......Page 34 Equality and Comparison Operators......Page 35 Conditional Operators......Page 36 Strings and Characters......Page 37 String Type......Page 38 Manipulating strings......Page 39 Arrays......Page 40 Default Element Initialization......Page 41 Jagged arrays......Page 42 Simplified Array Initialization Expressions......Page 43 Heap......Page 44 Definite Assignment......Page 45 Parameters......Page 46 Passing arguments by value......Page 47 The params modifier......Page 48 Optional parameters......Page 49 Named arguments......Page 50 Expressions and Operators......Page 51 Assignment Expressions......Page 52 Right-associative operators......Page 53 Operator Table......Page 54 Expression Statements......Page 57 The else clause......Page 58 Changing the flow of execution with braces......Page 59 The switch statement......Page 60 while and do-while loops......Page 61 foreach loops......Page 62 The goto statement......Page 63 Namespaces......Page 64 Name scoping......Page 66 The global:: qualifier......Page 67 Fields......Page 68 Overloading methods......Page 69 Implicit parameterless constructors......Page 70 Object Initializers......Page 71 Properties......Page 72 Indexers......Page 74 Implementing an indexer......Page 75 Static Constructors......Page 76 Partial Types and Methods......Page 77 Partial methods......Page 78 Inheritance......Page 79 Upcasting......Page 80 The as operator......Page 81 Virtual Function Members......Page 82 Hiding Inherited Members......Page 83 The base Keyword......Page 84 Constructors and Inheritance......Page 85 Overloading and Resolution......Page 86 The object Type......Page 87 Boxing and Unboxing......Page 88 The GetType Method and typeof Operator......Page 89 Equals, ReferenceEquals, and GetHashCode......Page 90 Structs......Page 91 Access Modifiers......Page 92 Accessibility Capping......Page 93 Interfaces......Page 94 Explicit Interface Implementation......Page 95 Reimplementing an Interface in a Subclass......Page 96 Enums......Page 97 Enum Conversions......Page 98 Flags Enums......Page 99 Nested Types......Page 100 Generic Types......Page 101 Generic Methods......Page 102 Declaring Type Parameters......Page 103 The default Generic Value......Page 104 Generic Constraints......Page 105 Self-Referencing Generic Declarations......Page 106 Covariance......Page 107 Delegates......Page 109 Writing Plug-in Methods with Delegates......Page 110 Multicast Delegates......Page 111 Generic Delegate Types......Page 112 The Func and Action Delegates......Page 113 Parameter variance......Page 114 Type parameter variance for generic delegates......Page 115 Events......Page 116 Standard Event Pattern......Page 117 Event Accessors......Page 120 Lambda Expressions......Page 121 Capturing Outer Variables......Page 123 Capturing iteration variables......Page 124 Anonymous Methods......Page 125 try Statements and Exceptions......Page 126 The catch Clause......Page 128 The finally Block......Page 129 The using statement......Page 130 Rethrowing an exception......Page 131 Key Properties of System.Exception......Page 132 Common Exception Types......Page 133 Enumeration......Page 134 Iterators......Page 135 Multiple yield statements......Page 137 Composing Sequences......Page 138 Nullable Struct......Page 140 Operator Lifting......Page 141 All other operators (+, –, *, /, %, &, |, ^, < >, +, ++, --, !, ~)......Page 142 Null Coalescing Operator......Page 143 Operator Functions......Page 144 Overloading Equality and Comparison Operators......Page 145 Custom Implicit and Explicit Conversions......Page 146 Extension Methods......Page 147 Extension methods versus instance methods......Page 148 Anonymous Types......Page 149 LINQ Fundamentals......Page 150 A simple query......Page 151 Take and Skip......Page 152 Aggregation operators......Page 153 Set operators......Page 154 Deferred Execution......Page 155 Standard Query Operators......Page 156 Chaining Query Operators......Page 160 Query Expressions......Page 161 Query expressions versus fluent queries......Page 163 The let Keyword......Page 164 Query Continuations......Page 165 Multiple Generators......Page 166 Joining......Page 167 GroupJoin......Page 169 Zip......Page 170 Ordering......Page 171 Grouping......Page 172 OfType and Cast......Page 173 Dynamic Binding......Page 174 Static Binding Versus Dynamic Binding......Page 175 Custom Binding......Page 176 Language Binding......Page 177 RuntimeBinderException......Page 178 Dynamic Conversions......Page 179 Dynamic Expressions......Page 180 Dynamic Member Overload Resolution......Page 181 Uncallable Functions......Page 182 Attribute Classes......Page 183 Specifying Multiple Attributes......Page 184 Writing Custom Attributes......Page 185 Caller Info Attributes (C# 5.0)......Page 186 Asynchronous Functions (C# 5.0)......Page 188 The await and async Keywords......Page 190 Capturing Local State......Page 192 Writing Asynchronous Functions......Page 193 Returning Task ......Page 194 Parallelism......Page 195 Asynchronous Lambda Expressions......Page 196 Pointer Basics......Page 197 The fixed Statement......Page 198 The Pointer-to-Member Operator......Page 199 Fixed-size buffers......Page 200 Preprocessor Directives......Page 201 Pragma Warning......Page 203 XML Documentation......Page 204 Standard XML Documentation Tags......Page 205 Index......Page 211 When you need answers for programming with C# 5.0, this practical and tightly focused book tells you exactly what you need to know—without long introductions or bloated samples. Easy to browse, it’s ideal as quick reference or as a guide to get you rapidly up to speed if you already know Java, C++, or an earlier version of C#.Written by the authors of C# 5.0 in a Nutshell, this book covers the entire C# 5.0 language, including:All of C#’s fundamentalsAdvanced topics such as operator overloading, type constraints, covariance & contravariance, iterators, nullable types, operator lifting, lambda expressions & closuresLINQ, starting with sequences, lazy execution and standard query operators, and finishing with a complete reference to query expressionsDynamic binding and C# 5.0’s new asynchronous functionsUnsafe code & pointers, custom attributes, preprocessor directives, and XML documentation When you're programming C# 5.0 and need a little help, this tightly focused and practical book tells you exactly what you need to know - without long introductions or bloated examples. It's ideal as a succinct quick reference or as a guide to get you rapidly up to speed if you already know Java, C++, or an earlier version of C#