E-Book, Englisch, 864 Seiten, Web PDF
Jagger / Perry / Sestoft Annotated C# Standard
1. Auflage 2010
ISBN: 978-0-08-055053-4
Verlag: Elsevier Science & Techn.
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 864 Seiten, Web PDF
ISBN: 978-0-08-055053-4
Verlag: Elsevier Science & Techn.
Format: PDF
Kopierschutz: 1 - PDF Watermark
Standards, while being definitive, do not usually serve as the best reference to the use of a programming language. Books on languages usually are able to explain usage better, but lack the definitive precision of a standard. This book combines the two, it is the standard with added explanatory material.
* Written by members of the standards committee
* Annotates the standard with practical implementation advice
* The definitive reference to the C# International Standard
Autoren/Hrsg.
Weitere Infos & Material
1;Front Cover;1
2;C# Annotated Standard;4
3;Copyright Page;5
4;Dedications;6
5;Contents;8
6;Foreword to the Annotated Standard;25
7;Preface to the Annotated Standard;26
7.1;Acknowledgments;26
8;About The Authors;29
9;Errata To The International Standard;30
10;The C# International Standard and Foreword;33
11;Introduction;34
11.1;CLI not required;34
12;Chapter 1: Scope;35
13;Chapter 2: Conformance;36
13.1;Interpreters;37
14;Chapter 3: Normative references;38
15;Chapter 4: Definitions;39
15.1;Application vs. program;39
15.2;Assembly vs. class files;39
15.3;Accessing class libraries;40
15.4;Programs, assemblies, applications and class libraries;40
16;Chapter 5: Notational conventions;42
17;Chapter 6: Acronyms and abbreviations;44
17.1;ASCII Rules!;44
17.2;The C# name;44
18;Chapter 7: General description;45
18.1;Where to look for requirements on unsafe constructs;45
19;Chapter 8: Language overview;46
19.1;Annotation free zone;46
19.2;8.1 Getting started;46
19.3;8.2 Types;47
19.3.1;8.2.1 Predefined types;49
19.3.2;8.2.2 Conversions;51
19.3.3;8.2.3 Array types;52
19.3.4;8.2.4 Type system unification;54
19.4;8.3 Variables and parameters;55
19.5;8.4 Automatic memory management;59
19.6;8.5 Expressions;61
19.7;8.6 Statements;62
19.8;8.7 Classes;65
19.8.1;8.7.1 Constants;68
19.8.2;8.7.2 Fields;68
19.8.3;8.7.3 Methods;69
19.8.4;8.7.4 Properties;72
19.8.5;8.7.5 Events;72
19.8.6;8.7.6 Operators;74
19.8.7;8.7.7 Indexers;75
19.8.8;8.7.8 Instance constructors;77
19.8.9;8.7.9 Finalizers;78
19.8.10;8.7.10 Static constructors;78
19.8.11;8.7.11 Inheritance;79
19.8.12;8.7.12 Static classes;80
19.8.13;8.7.13 Partial type declarations;81
19.9;8.8 Structs;82
19.10;8.9 Interfaces;82
19.11;8.10 Delegates;84
19.12;8.11 Enums;85
19.13;8.12 Namespaces and assemblies;86
19.14;8.13 Versioning;88
19.15;8.14 Extern aliases;90
19.16;8.15 Attributes;92
19.17;8.16 Generics;94
19.17.1;8.16.1 Why generics?;94
19.17.2;8.16.2 Creating and consuming generics;95
19.17.3;8.16.3 Multiple type parameters;96
19.17.4;8.16.4 Constraints;96
19.17.5;8.16.5 Generic methods;98
19.18;8.17 Anonymous methods;99
19.19;8.18 Iterators;102
19.20;8.19 Nullable types;106
20;Chapter 9: Lexical structure;109
20.1;9.1 Programs;109
20.1.1;Much ado about nothing;109
20.2;9.2 Grammars;110
20.2.1;9.2.1 Lexical grammar;110
20.2.2;9.2.2 Syntactic grammar;110
20.2.3;9.2.3 Grammar ambiguities;111
20.2.3.1;Rationale: the “following token” set;111
20.2.3.2;Similar cast expression ambiguity;112
20.2.3.3;F(G>7);112
20.3;9.3 Lexical analysis;112
20.3.1;9.3.1 Line terminators;113
20.3.2;9.3.2 Comments;114
20.3.3;9.3.3 White space;115
20.4;9.4 Tokens;115
20.4.1;9.4.1 Unicode escape sequences;116
20.4.1.1;No escapes in verbatim strings;116
20.4.1.2;No escapes in comments;116
20.4.2;9.4.2 Identifiers;117
20.4.2.1;Identifier normalization;118
20.4.2.2;The humble underscore;118
20.4.2.3;Keyword escape mechanism;119
20.4.2.4;Code generation;120
20.4.3;9.4.3 Keywords;120
20.4.3.1;Language evolution;120
20.4.4;9.4.4 Literals;121
20.4.4.1;9.4.4.1 Boolean literals;121
20.4.4.1.1;Boolean arguments considered harmful?;121
20.4.4.2;9.4.4.2 Integer literals;122
20.4.4.2.1;Historical note;123
20.4.4.2.2;Boundary differences;123
20.4.4.3;9.4.4.3 Real literals;123
20.4.4.3.1;What is 1.D?;124
20.4.4.3.2;Money or deciMal?;124
20.4.4.4;9.4.4.4 Character literals;125
20.4.4.4.1;No octal character escapes;126
20.4.4.5;9.4.4.5 String literals;126
20.4.4.5.1;Platform independent newlines;127
20.4.4.5.2;Historical note;127
20.4.4.5.3;Happy birthday, Joel;128
20.4.4.5.4;Overspecification…;128
20.4.4.5.5;Hexadecimal escape character pitfalls;128
20.4.4.6;9.4.4.6 The null literal;129
20.4.5;9.4.5 Operators and punctuators;129
20.4.5.1;>>== tokenization oddity;130
20.4.5.2;Tokenization anecdote;130
20.5;9.5 Pre-processing directives;130
20.5.1;To pre-process, or not pre-process?;131
20.5.2;Why no delimited comments in #directives?;131
20.5.3;Why no macros?;132
20.5.4;9.5.1 Conditional compilation symbols;132
20.5.4.1;Conditional symbol oddity;133
20.5.4.2;No program-wide pre-processing symbols;133
20.5.5;9.5.2 Pre-processing expressions;133
20.5.5.1;Inequality is xor; equality is not-xor;134
20.5.6;9.5.3 Declaration directives;134
20.5.6.1;Rationale: pp-declaration placement;135
20.5.6.2;Conditional symbol style;136
20.5.7;9.5.4 Conditional compilation directives;136
20.5.7.1;Another issue with comments and #if;139
20.5.7.2;Carbuncle;139
20.5.8;9.5.5 Diagnostic directives;140
20.5.8.1;Diagnostic directive example;140
20.5.9;9.5.6 Region control;141
20.5.9.1;Historical note;141
20.5.10;9.5.7 Line directives;141
20.5.10.1;Historical note;142
20.5.10.2;#line example;142
20.5.11;9.5.8 Pragma directives;143
21;Chapter 10: Basic concepts;144
21.1;The emperor has no threads!;144
21.2;Example: Synchronization and Threads;147
21.3;10.1 Application startup;150
21.3.1;Main is callable;151
21.4;10.2 Application termination;151
21.4.1;Suppression of finalizers;152
21.4.2;No infanticide;152
21.5;10.3 Declarations;152
21.5.1;Declaration spaces and anonymous methods;154
21.6;10.4 Members;156
21.6.1;10.4.1 Namespace members;156
21.6.2;10.4.2 Struct members;156
21.6.3;10.4.3 Enumeration members;157
21.6.4;10.4.4 Class members;157
21.6.5;10.4.5 Interface members;157
21.6.6;10.4.7 Delegate members;157
21.7;10.5 Member access;157
21.7.1;10.5.1 Declared accessibility;157
21.7.1.1;Clarification of internal;158
21.7.1.2;Clarification of protected internal;158
21.7.1.3;Accessibility vs. visibility;159
21.7.1.4;Default considered harmful?;159
21.7.1.5;Default class accessibility pitfall;159
21.7.2;10.5.2 Accessibility domains;160
21.7.3;10.5.3 Protected access for instance members;162
21.7.3.1;Rationale: access to protected members;163
21.7.3.2;Access to other instantiations;164
21.7.3.3;Twin or just sibling?;164
21.7.4;10.5.4 Accessibility constraints;165
21.7.4.1;Declaration accessibility consistency;166
21.7.4.2;Constrained object creation;167
21.8;10.6 Signatures and overloading;167
21.8.1;Explicit interface implementation;167
21.8.2;Pitfall of overloading on ref or out;168
21.8.3;Why no ref and out overloading?;168
21.9;10.7 Scopes;169
21.9.1;Declaration scope within switch statements;170
21.9.2;Anonymous methods impact scope and lifetime;171
21.9.3;In scope but not referable;172
21.9.4;10.7.1 Name hiding;173
21.9.4.1;Context-sensitive name resolution;173
21.9.4.2;10.7.1.1 Hiding through nesting;173
21.9.4.2.1;Name hiding in a constructor;174
21.9.4.3;10.7.1.2 Hiding through inheritance;175
21.9.4.3.1;Abstract cannot be hidden;176
21.10;10.8 Namespace and type names;177
21.10.1;An extended example;179
21.10.2;10.8.1 Unqualified name;183
21.10.3;10.8.2 Fully qualified names;183
21.11;10.9 Automatic memory management;184
21.11.1;Constructors, exceptions, and finalizers: a volatile combination;185
21.11.2;One implementation’s garbage is another’s treasure;186
21.12;10.10 Execution order;189
21.12.1;Synchronous order, asynchronous chaos;190
22;Chapter 11: Types;192
22.1;Shallow copying of value types;192
22.2;Uniformity and hidden costs;192
22.2.1;11.1 Value types;193
22.2.1.1;The immediate base class of value types;194
22.2.1.2;11.1.1 The System.ValueType type;194
22.2.1.3;11.1.2 Default constructors;195
22.2.1.4;11.1.3 Struct types;195
22.2.1.5;11.1.4 Simple types;195
22.2.1.5.1;Use the keywords!;196
22.2.1.5.2;Keywords not allowed!;197
22.2.1.5.3;Do not use the keywords;197
22.2.1.6;11.1.5 Integral types;197
22.2.1.6.1;byte/sbyte naming oddity;198
22.2.1.7;11.1.6 Floating point types;199
22.2.1.7.1;Two’s company, three’s a crowd;199
22.2.1.7.2;The other floating point type;199
22.2.1.7.3;Rarity is relative;200
22.2.1.8;11.1.7 The decimal type;201
22.2.1.8.1;IEEE decimal;201
22.2.1.8.2;Using IEEE decimal in C#: supporting legacy data;201
22.2.1.9;11.1.8 The bool type;202
22.2.1.9.1;Strong Booleans;203
22.2.1.10;11.1.9 Enumeration types;203
22.2.1.10.1;Weak enums: distinct but similar;203
22.2.2;11.2 Reference types;203
22.2.2.1;Objects vs. values;204
22.2.2.1.1;11.2.1 Class types;204
22.2.2.1.2;11.2.2 The object type;204
22.2.2.1.3;11.2.3 The string type;204
22.2.2.1.3.1;Strings are immutable;204
22.2.2.1.3.2;Insecure strings;205
22.2.2.1.4;11.2.4 Interface types;205
22.2.2.1.4.1;Interface inheritance is not class inheritance;205
22.2.2.1.5;11.2.5 Array types;205
22.2.2.1.6;11.2.6 Delegate types;205
22.2.2.1.7;11.2.7 The null type;206
22.2.2.1.7.1;Pseudo-type;206
22.2.3;11.3 Boxing and unboxing;206
22.2.3.1;Can you tell whether a struct instance is boxed?;206
22.2.3.1.1;11.3.1 Boxing conversions;208
22.2.3.1.1.1;White lies and diaphanous types;209
22.2.3.1.2;11.3.2 Unboxing conversions;211
22.2.3.1.2.1;Sometimes your host bites…;212
22.2.4;11.4 Nullable types;212
22.2.4.1;11.4.1 Members;213
22.2.4.1.1;Default value;213
22.2.4.1.2;To be, or not to be…a value type;213
22.2.4.2;11.4.2 Implemented interfaces;213
23;Chapter 12: Variables;214
23.1;Aliasing;214
23.2;12.1 Variable categories;214
23.2.1;12.1.1 Static variables;214
23.2.2;12.1.2 Instance variables;214
23.2.2.1;12.1.2.1 Instance variables in classes;215
23.2.2.2;12.1.2.2 Instance variables in structs;215
23.2.3;12.1.3 Array elements;215
23.2.4;12.1.4 Value parameters;215
23.2.5;12.1.5 Reference parameters;215
23.2.5.1;Examples;216
23.2.5.2;Example: linked data structures;216
23.2.5.3;Example: avoiding repeated index calculations;217
23.2.5.4;Example: avoiding simple reassignment errors;218
23.2.6;12.1.6 Output parameters;219
23.2.6.1;Output parameters vs. reference parameters;219
23.2.6.2;Using output parameters to return multiple results;220
23.2.7;12.1.7 Local variables;220
23.2.7.1;Extended life or early death;221
23.3;12.2 Default values;221
23.3.1;Recursive initialization;222
23.3.2;Pointless instance field initialization;222
23.4;12.3 Definite assignment;222
23.4.1;Definitely assigned, maybe…;223
23.4.1.1;12.3.1 Initially assigned variables;224
23.4.1.2;12.3.2 Initially unassigned variables;224
23.4.1.3;12.3.3 Precise rules for determining definite assignment;224
23.4.1.3.1;Current compilers, constant expressions, and definite assignment;225
23.4.1.3.1.1;12.3.3.1 General rules for statements;226
23.4.1.3.1.1.1;Arriving from the unreachable;226
23.4.1.3.1.2;12.3.3.2 Block statements, checked, and unchecked statements;227
23.4.1.3.1.3;12.3.3.3 Expression statements;227
23.4.1.3.1.4;12.3.3.4 Declaration statements;227
23.4.1.3.1.5;12.3.3.5 If statements;227
23.4.1.3.1.5.1;Definitely confused?;227
23.4.1.3.1.6;12.3.3.6 Switch statements;228
23.4.1.3.1.7;12.3.3.7 While statements;228
23.4.1.3.1.8;12.3.3.8 Do statements;228
23.4.1.3.1.9;12.3.3.9 For statements;229
23.4.1.3.1.10;12.3.3.10 Break, continue, and goto statements;229
23.4.1.3.1.11;12.3.3.11 Throw statements;229
23.4.1.3.1.12;12.3.3.12 Return statements;229
23.4.1.3.1.13;12.3.3.13 Try-catch statements;230
23.4.1.3.1.14;12.3.3.14 Try-finally statements;230
23.4.1.3.1.15;12.3.3.15 Try-catch-finally statements;230
23.4.1.3.1.16;12.3.3.16 Foreach statements;231
23.4.1.3.1.17;12.3.3.17 Using statements;232
23.4.1.3.1.18;12.3.3.18 Lock statements;232
23.4.1.3.1.19;12.3.3.19 General rules for simple expressions;232
23.4.1.3.1.20;12.3.3.20 General rules for expressions with embedded expressions;232
23.4.1.3.1.21;12.3.3.21 Invocation expressions and object creation expressions;233
23.4.1.3.1.21.1;Trying to peek at an uninitialized variable;233
23.4.1.3.1.22;12.3.3.22 Simple assignment expressions;233
23.4.1.3.1.23;12.3.3.23 && expressions;234
23.4.1.3.1.24;12.3.3.24 || expressions;235
23.4.1.3.1.25;12.3.3.25 ! expressions;236
23.4.1.3.1.26;12.3.3.26 ?: expressions;236
23.4.1.3.1.27;12.3.3.27 Anonymous method expressions;236
23.4.1.3.1.28;12.3.3.28 Yield statements;237
23.4.1.3.1.29;12.3.3.29 ?? expressions;237
23.4.1.3.1.29.1;Alternative definite assignment rules for the ?? operator;238
23.5;12.4 Variable references;239
23.5.1;“classified as a variable”;239
23.6;12.5 Atomicity of variable references;240
23.6.1;Atomicity vs. volatility;240
24;Chapter 13: Conversions;241
24.1;13.1 Implicit conversions;241
24.1.1;13.1.1 Identity conversion;241
24.1.2;13.1.2 Implicit numeric conversions;241
24.1.2.1;Loss of precision;242
24.1.3;13.1.3 Implicit enumeration conversions;242
24.1.3.1;Equal rights for hexadecimals;242
24.1.4;13.1.4 Implicit reference conversions;243
24.1.4.1;Conversions to implemented interfaces;243
24.1.5;13.1.5 Boxing conversions;244
24.1.5.1;Leave my box alone…;244
24.1.6;13.1.6 Implicit type parameter conversions;245
24.1.7;13.1.7 Implicit constant expression conversions;245
24.1.7.1;Mind your constants;245
24.1.8;13.1.8 User-defined implicit conversions;245
24.2;13.2 Explicit conversions;245
24.2.1;Being explicitly implicit;246
24.2.2;13.2.1 Explicit numeric conversions;246
24.2.2.1;Why no double to decimal implicit conversions?;248
24.2.2.2;Decimal conversion exceptions dependent on format;248
24.2.3;13.2.2 Explicit enumeration conversions;249
24.2.3.1;Dubious explicit enum conversions;249
24.2.4;13.2.3 Explicit reference conversions;249
24.2.4.1;Never changes, maybe…;250
24.2.4.2;Conversion from System.Collections.Generic.IList;251
24.2.4.3;Mauled by the host, again…;252
24.2.5;13.2.4 Unboxing conversions;252
24.2.6;13.2.5 Explicit type parameter conversions;253
24.2.7;13.2.6 User-defined explicit conversions;253
24.3;13.3 Standard conversions;253
24.3.1;13.3.1 Standard implicit conversions;254
24.3.2;13.3.2 Standard explicit conversions;254
24.4;13.4 User-defined conversions;254
24.4.1;13.4.1 Permitted user-defined conversions;254
24.4.2;13.4.2 Evaluation of user-defined conversions;254
24.4.3;13.4.3 User-defined implicit conversions;255
24.4.4;13.4.4 User-defined explicit conversions;256
24.5;13.5 Anonymous method conversions;257
24.5.1;Anecdote: Mono widget design improves C#;257
24.6;13.6 Method group conversions;259
24.6.1;Non-orthogonality;259
24.6.2;Through a glass darkly…;260
24.7;13.7 Conversions involving nullable types;262
24.7.1;Wrapping conversions;262
24.7.2;13.7.1 Null type conversions;262
24.7.3;13.7.2 Nullable conversions;262
24.7.3.1;Nullable “identity” conversions;263
24.7.4;13.7.3 Lifted conversions;263
24.7.4.1;The same, but different;263
25;Chapter 14: Expressions;264
25.1;14.1 Expression classifications;264
25.1.1;14.1.1 Values of expressions;265
25.2;14.2 Operators;265
25.2.1;Operand order of evaluation;266
25.2.2;14.2.1 Operator precedence and associativity;266
25.2.2.1;Erratum and clarification;267
25.2.3;14.2.2 Operator overloading;267
25.2.4;14.2.3 Unary operator overload resolution;268
25.2.5;14.2.4 Binary operator overload resolution;269
25.2.6;14.2.5 Candidate user-defined operators;269
25.2.7;14.2.6 Numeric promotions;270
25.2.7.1;Land of surprises;270
25.2.7.2;Into the void;272
25.2.7.3;Loosely literal;272
25.2.7.4;Reasons for numeric promotion;272
25.2.7.5;14.2.6.1 Unary numeric promotions;273
25.2.7.6;14.2.6.2 Binary numeric promotions;273
25.2.8;14.2.7 Lifted operators;274
25.2.8.1;Null values in C# and in SQL;275
25.3;14.3 Member lookup;276
25.3.1;14.3.1 Base types;277
25.4;14.4 Function members;278
25.4.1;14.4.1 Argument lists;280
25.4.1.1;Unrealistic optimism;281
25.4.1.2;Hidden (small) costs of parameter arrays;282
25.4.1.3;String formatting not part of the Standard;282
25.4.2;14.4.2 Overload resolution;283
25.4.2.1;Overload resolution: C# vs. CIL;284
25.4.2.2;14.4.2.1 Applicable function member;284
25.4.2.3;14.4.2.2 Better function member;285
25.4.2.4;14.4.2.3 Better conversion;286
25.4.2.4.1;Lost digits;286
25.4.2.4.2;Better conversion pitfall;286
25.4.3;14.4.3 Function member invocation;287
25.4.3.1;No boxing;289
25.4.3.2;14.4.3.1 Invocations on boxed instances;289
25.4.3.2.1;From diaphanous to concrete;290
25.4.3.2.2;But wait, there is more…;290
25.5;14.5 Primary expressions;290
25.5.1;14.5.1 Literals;291
25.5.2;14.5.2 Simple names;291
25.5.2.1;14.5.2.1 Invariant meaning in blocks;293
25.5.2.1.1;Simpler confusion;294
25.5.3;14.5.3 Parenthesized expressions;294
25.5.4;14.5.4 Member access;295
25.5.4.1;14.5.4.1 Identical simple names and type names;296
25.5.5;14.5.5 Invocation expressions;297
25.5.5.1;14.5.5.1 Method invocations;297
25.5.5.1.1;What is not considered during overload resolution?;298
25.5.5.1.2;Sometimes there is no right answer…;299
25.5.5.2;14.5.5.2 Delegate invocations;301
25.5.5.2.1;Raising events and thread safety;301
25.5.6;14.5.6 Element access;302
25.5.6.1;14.5.6.1 Array access;303
25.5.6.1.1;Array indexing corner case;303
25.5.6.1.2;Red Katipo;304
25.5.6.2;14.5.6.2 Indexer access;304
25.5.7;14.5.7 This access;305
25.5.7.1;this = that?;306
25.5.8;14.5.8 Base access;306
25.5.8.1;Base access is nonvirtual;306
25.5.8.2;No override bypass;307
25.5.9;14.5.9 Postfix increment and decrement operators;308
25.5.9.1;Overflow eventually…;308
25.5.10;14.5.10 The new operator;309
25.5.10.1;New for old?;310
25.5.10.2;14.5.10.1 Object creation expressions;310
25.5.10.3;14.5.10.2 Array creation expressions;312
25.5.10.3.1;Java difference;313
25.5.10.4;14.5.10.3 Delegate creation expressions;314
25.5.10.4.1;Name equivalence and conversions;315
25.5.10.4.2;Creating a delegate from a delegate;318
25.5.10.4.3;Breaking change;319
25.5.11;14.5.11 The typeof operator;320
25.5.11.1;typeof(Generic<,>);322
25.5.12;14.5.12 The sizeof operator;323
25.5.12.1;Marshal.SizeOf != sizeof;324
25.5.13;14.5.13 The checked and unchecked operators;324
25.5.13.1;Checked expression pitfall;325
25.5.13.2;(Un)checked constants;325
25.5.13.3;The meaning of (un)checked;328
25.5.14;14.5.14 Default value expression;328
25.5.14.1;Historical aside;328
25.5.15;14.5.15 Anonymous methods;329
25.5.15.1;Breaking the ties that bind…;329
25.5.15.2;Anonymous sharing;329
25.5.15.3;14.5.15.1 Anonymous method signatures;330
25.5.15.4;14.5.15.2 Anonymous method blocks;330
25.5.15.5;14.5.15.3 Outer variables;331
25.5.15.5.1;14.5.15.3.1 Captured outer variables;331
25.5.15.5.1.1;Captured local variables: modification and lifetime;332
25.5.15.5.1.2;Captured variable pitfall;332
25.5.15.5.1.3;Caution: space leaks;333
25.5.15.5.1.4;Visitor-style enumeration;333
25.5.15.5.2;14.5.15.3.2 Instantiation of local variables;335
25.5.15.5.2.1;Caution: local variables shared between threads;338
25.5.15.5.2.2;Caution: implementation-dependent space leaks;338
25.5.15.6;14.5.15.4 Anonymous method evaluation;340
25.5.15.6.1;Interlude: call-by-name;341
25.5.15.7;14.5.15.5 Implementation example;344
25.5.15.7.1;Anonymous methods, generic parameters, and a bug;347
25.6;14.6 Unary expressions;348
25.6.1;14.6.1 Unary plus operator;348
25.6.2;14.6.2 Unary minus operator;348
25.6.3;14.6.3 Logical negation operator;349
25.6.4;14.6.4 Bitwise complement operator;350
25.6.5;14.6.5 Prefix increment and decrement operators;350
25.6.5.1;Obscure C++ difference;350
25.6.6;14.6.6 Cast expressions;351
25.7;14.7 Arithmetic operators;352
25.7.1;Void arithmetic;352
25.7.2;Operator to instruction/method mapping not defined;352
25.7.3;14.7.1 Multiplication operator;353
25.7.4;14.7.2 Division operator;354
25.7.4.1;Divided we stand;354
25.7.4.2;A touch of Pentium;356
25.7.5;14.7.3 Remainder operator;357
25.7.5.1;Remainder latitude;357
25.7.5.2;IEC remainder;358
25.7.5.3;Further latitude;358
25.7.6;14.7.4 Addition operator;359
25.7.6.1;Hidden boxing;360
25.7.6.2;Implicitly avoiding the boxing;361
25.7.6.3;String concatenation efficiency;362
25.7.7;14.7.5 Subtraction operator;363
25.7.7.1;Negation, not negative;364
25.7.7.2;Legacy coding style;366
25.8;14.8 Shift operators;366
25.8.1;Negative shifts;367
25.8.2;Out of bounds shift count behavior?;368
25.8.3;Zero-extension signed shift;369
25.9;14.9 Relational and type-testing operators;369
25.9.1;Incomparable;369
25.9.2;All references are equal, but some are more equal than others;370
25.9.3;The invisible contract;373
25.9.4;Equality for all;374
25.9.5;Exploiting the built-in equality on value types;375
25.9.6;14.9.1 Integer comparison operators;375
25.9.7;14.9.2 Floating-point comparison operators;376
25.9.7.1;NaNs may be equal;377
25.9.8;14.9.3 Decimal comparison operators;377
25.9.9;14.9.4 Boolean equality operators;378
25.9.10;14.9.5 Enumeration comparison operators;378
25.9.11;14.9.6 Reference type equality operators;378
25.9.11.1;Specification mistake;379
25.9.11.2;Boxing not required;379
25.9.12;14.9.7 String equality operators;381
25.9.13;14.9.8 Delegate equality operators;381
25.9.13.1;Creating unique invocation list items;382
25.9.14;14.9.9 Equality operators and nullable types;383
25.9.15;14.9.10 is operator;383
25.9.16;14.9.11 as operator;384
25.9.16.1;is and as ignore user-defined conversions;385
25.10;14.10 Logical operators;386
25.10.1;14.10.1 Integer logical operators;386
25.10.1.1;Extra bits;387
25.10.1.2;Bit buckets;387
25.10.2;14.10.2 Enumeration logical operators;387
25.10.3;14.10.3 Boolean logical operators;388
25.10.3.1;Forgotten “long-circuiting” operators;388
25.10.4;14.10.4 The bool? logical operators;388
25.11;14.11 Conditional logical operators;389
25.11.1;14.11.1 Boolean conditional logical operators;389
25.11.2;14.11.2 User-defined conditional logical operators;390
25.11.2.1;true/false overloading;390
25.12;14.12 The null coalescing operator;391
25.12.1;Subtle interaction with implicit conversions;391
25.13;14.13 Conditional operator;393
25.14;14.14 Assignment operators;393
25.14.1;14.14.1 Simple assignment;394
25.14.2;14.14.2 Compound assignment;396
25.14.3;14.14.3 Event assignment;397
25.15;14.15 Expression;397
25.16;14.16 Constant expressions;397
25.16.1;Expressions can be constant;398
25.16.2;Compile time constant evaluation;399
25.16.3;Divide by zero always throws;399
25.17;14.17 Boolean expressions;400
26;Chapter 15: Statements;401
26.1;15.1 End points and reachability;401
26.1.1;Flow-analysis vs. unsigned types;402
26.2;15.2 Blocks;403
26.2.1;15.2.1 Statement lists;404
26.3;15.3 The empty statement;404
26.4;15.4 Labeled statements;405
26.5;15.5 Declaration statements;405
26.5.1;15.5.1 Local variable declarations;406
26.5.2;15.5.2 Local constant declarations;406
26.6;15.6 Expression statements;407
26.7;15.7 Selection statements;408
26.7.1;15.7.1 The if statement;408
26.7.2;15.7.2 The switch statement;409
26.7.2.1;Switching on a string;409
26.7.2.2;Switching on nullables…;410
26.7.2.3;Et tu, Mono?;411
26.7.2.4;Independent, within limits;413
26.7.2.5;Switch section reordering;415
26.7.2.6;Bad switch in a bad switch;415
26.8;15.8 Iteration statements;415
26.8.1;15.8.1 The while statement;415
26.8.2;15.8.2 The do statement;416
26.8.3;15.8.3 The for statement;416
26.8.3.1;Iteration count not fixed;417
26.8.4;15.8.4 The foreach statement;418
26.8.4.1;GetEnumerator() selection;419
26.8.4.2;Why is the iteration variable read-only?;420
26.8.4.3;Subtle change due to anonymous methods;420
26.8.4.4;Implications of MoveNext();422
26.8.4.5;Iteration variable: read-only != readonly;422
26.9;15.9 Jump statements;423
26.9.1;15.9.1 The break statement;424
26.9.2;15.9.2 The continue statement;425
26.9.3;15.9.3 The goto statement;425
26.9.4;15.9.4 The return statement;427
26.9.5;15.9.5 The throw statement;427
26.9.5.1;null ! NullReferenceException;428
26.9.5.2;Plug-in style exception handling;428
26.9.5.3;Spot the difference;429
26.10;15.10 The try statement;430
26.10.1;Possible security vulnerability;431
26.10.2;Variety is the spice of life;432
26.10.3;Why is the exception variable name optional?;432
26.10.4;Rationale: Why is jumping out of a finally block forbidden?;433
26.10.5;Unstoppable exceptions?;434
26.10.6;Sometimes other code runs before finally;435
26.11;15.11 The checked and unchecked statements;436
26.11.1;Nested un/checking?;437
26.12;15.12 The lock statement;437
26.12.1;Lock thread safety?;438
26.12.2;Lock safety;439
26.13;15.13 The using statement;439
26.13.1;Rationale: designing for nonmemory resources;440
26.13.2;Redux: One implementation’s treasure is another’s garbage;443
26.14;15.14 The yield statement;444
26.14.1;yield syntax?;446
27;Chapter 16: Namespaces;447
27.1;16.1 Compilation units;447
27.1.1;Compilation-unit misnomer;447
27.1.2;Class libraries;448
27.2;16.2 Namespace declarations;448
27.3;16.3 Extern alias directives;449
27.3.1;Extern alias implied flexibility;450
27.4;16.4 Using directives;450
27.4.1;16.4.1 Using alias directives;451
27.4.1.1;Using alias constraints;455
27.4.1.2;Using alias reordering;456
27.4.2;16.4.2 Using namespace directives;456
27.4.2.1;Ouch, it bit me!;458
27.4.2.2;Intercepting calls;460
27.5;16.5 Namespace members;461
27.6;16.6 Type declarations;461
27.7;16.7 Qualified alias member;462
28;Chapter 17: Classes;465
28.1;17.1 Class declarations;465
28.1.1;Trailing semicolons;465
28.1.2;17.1.1 Class modifiers;465
28.1.2.1;17.1.1.1 Abstract classes;466
28.1.2.1.1;abstract + override == redundant?;467
28.1.2.1.2;abstract + override != redundant;467
28.1.2.2;17.1.1.2 Sealed classes;468
28.1.2.3;17.1.1.3 Static classes;468
28.1.2.3.1;Some bugs lead to features;469
28.1.3;17.1.2 Class base specification;470
28.1.3.1;Positional inheritance notation;470
28.1.3.2;17.1.2.1 Base classes;471
28.1.3.3;17.1.2.2 Interface implementations;472
28.1.4;17.1.3 Class body;473
28.1.5;17.1.4 Partial declarations;473
28.1.5.1;Divide and confuse…;473
28.1.5.2;But sometimes useful;474
28.2;17.2 Class members;476
28.2.1;Minor Java difference;477
28.2.2;17.2.1 Inheritance;479
28.2.3;17.2.2 The new modifier;480
28.2.4;17.2.3 Access modifiers;480
28.2.4.1;Absent modifier != default modifier;480
28.2.5;17.2.4 Constituent types;481
28.2.6;17.2.5 Static and instance members;481
28.2.6.1;No access to static members through instance expressions;481
28.2.6.2;Rationale: instance method call semantics;482
28.2.7;17.2.6 Nested types;484
28.2.7.1;Delegates and enums are types too;484
28.2.7.2;17.2.6.1 Fully qualified name;485
28.2.7.3;17.2.6.2 Declared accessibility;485
28.2.7.4;17.2.6.3 Hiding;485
28.2.7.5;17.2.6.4 this access;486
28.2.7.5.1;Simulating Java-style inner classes;487
28.2.7.6;17.2.6.5 Access to private and protected members of the containing type;488
28.2.7.6.1;Access clarification;489
28.2.7.6.2;Older C++ difference;489
28.2.8;17.2.7 Reserved member names;490
28.2.8.1;17.2.7.1 Member names reserved for properties;490
28.2.8.1.1;Neutral, but not agnostic;490
28.2.8.1.2;The meaning of “reserved”;491
28.2.8.2;17.2.7.2 Member names reserved for events;492
28.2.8.3;17.2.7.3 Member names reserved for indexers;492
28.2.8.3.1;Indexer names on CLI;492
28.2.8.4;17.2.7.4 Member names reserved for finalizers;493
28.3;17.3 Constants;493
28.3.1;Constant references do not trigger static initialization;493
28.3.2;Having nothing might be useful;494
28.4;17.4 Fields;495
28.4.1;17.4.1 Static and instance fields;497
28.4.2;17.4.2 Readonly fields;497
28.4.2.1;Readonly yet modifiable;497
28.4.2.2;17.4.2.1 Using static readonly fields for constants;497
28.4.2.3;17.4.2.2 Versioning of constants and static readonly fields;498
28.4.3;17.4.3 Volatile fields;498
28.4.3.1;Evolution of volatile;499
28.4.3.2;Unrealistic optimism redux;500
28.4.4;17.4.4 Field initialization;501
28.4.5;17.4.5 Variable initializers;501
28.4.5.1;17.4.5.1 Static field initialization;502
28.4.5.1.1;Static fields may never be initialized;504
28.4.5.2;17.4.5.2 Instance field initialization;504
28.4.5.2.1;Rationale: why field initializers cannot reference instance fields;505
28.4.5.2.2;Unable to create inner objects;505
28.5;17.5 Methods;505
28.5.1;Why no throw specifications?;507
28.5.2;17.5.1 Method parameters;508
28.5.2.1;17.5.1.1 Value parameters;509
28.5.2.2;17.5.1.2 Reference parameters;510
28.5.2.2.1;A round peg in a square hole…;510
28.5.2.3;17.5.1.3 Output parameters;512
28.5.2.4;17.5.1.4 Parameter arrays;513
28.5.2.4.1;Params arrays can be null;514
28.5.2.4.2;Is the params keyword needed?;516
28.5.3;17.5.2 Static and instance methods;517
28.5.4;17.5.3 Virtual methods;517
28.5.4.1;Instance methods are nonvirtual by default;518
28.5.4.2;Non-virtual calling of virtual methods;519
28.5.4.3;Invocation by compile-time and run-time type;521
28.5.5;17.5.4 Override methods;521
28.5.6;17.5.5 Sealed methods;523
28.5.7;17.5.6 Abstract methods;524
28.5.8;17.5.7 External methods;525
28.5.9;17.5.8 Method body;526
28.5.9.1;Foreign bodies;526
28.5.10;17.5.9 Method overloading;527
28.6;17.6 Properties;527
28.6.1;A property cannot be a ref or out parameter;528
28.6.2;The accessors of a property cannot be named;528
28.6.3;17.6.1 Static and instance properties;529
28.6.4;17.6.2 Accessors;529
28.6.4.1;More foreign bodies;530
28.6.4.2;Value hiding in an accessor;530
28.6.4.3;The most frequently requested new feature;538
28.6.5;17.6.3 Virtual, sealed, override, and abstract accessors;538
28.7;17.7 Events;540
28.7.1;Externally, events are write-only;541
28.7.2;17.7.1 Field-like events;542
28.7.2.1;Do-nothing delegate;543
28.7.2.2;Event –= vs. +=;544
28.7.2.3;Non-thread-safe struct events;547
28.7.3;17.7.2 Event accessors;548
28.7.3.1;Custom event handler semantics;550
28.7.4;17.7.3 Static and instance events;550
28.7.5;17.7.4 Virtual, sealed, override, and abstract accessors;550
28.8;17.8 Indexers;551
28.8.1;No static indexers;552
28.8.2;Named indexers;555
28.8.3;17.8.1 Indexer overloading;556
28.9;17.9 Operators;556
28.9.1;The best laid plans of mice and men…;557
28.9.2;Bedfellows: operators and structs;558
28.9.3;17.9.1 Unary operators;558
28.9.4;17.9.2 Binary operators;559
28.9.5;17.9.3 Conversion operators;560
28.9.5.1;Indirect implicit conversion to an interface;561
28.10;17.10 Instance constructors;562
28.10.1;17.10.1 Constructor initializers;563
28.10.1.1;Infinite recursion not erroneous;564
28.10.2;17.10.2 Instance variable initializers;564
28.10.3;17.10.3 Constructor execution;565
28.10.3.1;Rationale: field initialization before base constructor invocation;567
28.10.4;17.10.4 Default constructors;568
28.10.5;17.10.5 Private constructors;568
28.10.6;17.10.6 Optional instance constructor parameters;569
28.11;17.11 Static constructors;569
28.11.1;No access specifier; no parameter;570
28.11.2;Trigger one, trigger all;570
28.11.3;Constants are not “referenced”;571
28.11.4;Which static constructor is triggered?;571
28.11.5;Indeterminately deterministic;574
28.12;17.12 Finalizers;575
28.12.1;C++ destructors versus C# finalizers;575
28.12.2;Thwarting a finalizer;576
28.12.3;Thwarting a finalizer on the CLI;577
28.12.4;Finalizer issues;578
28.12.5;Final deadlock;578
28.12.6;Erroneous details;579
29;Chapter 18: Structs;580
29.1;Freedom of allocation;580
29.2;“Heap” allocation required;580
29.3;Union City blues;581
29.4;Premature optimization;582
29.5;Danger, UXB!;583
29.6;18.1 Struct declarations;584
29.6.1;18.1.1 Struct modifiers;585
29.6.2;18.1.2 Struct interfaces;585
29.6.3;18.1.3 Struct body;585
29.7;18.2 Struct members;585
29.8;18.3 Class and struct differences;586
29.8.1;readonly value-type fields;586
29.8.2;18.3.1 Value semantics;587
29.8.2.1;Struct layout cycles;588
29.8.2.2;Struct equality contracts;589
29.8.3;18.3.2 Inheritance;590
29.8.4;18.3.3 Assignment;590
29.8.5;18.3.4 Default values;590
29.8.5.1;Why do structs always have a default constructor?;591
29.8.6;18.3.5 Boxing and unboxing;592
29.8.7;18.3.6 Meaning of this;592
29.8.8;18.3.7 Field initializers;592
29.8.9;18.3.8 Constructors;593
29.8.9.1;Definite assignment inside a struct constructor;594
29.8.9.2;Non–dynamic allocation using new;594
29.8.10;18.3.9 Finalizers;594
29.8.10.1;Why no ~S() in struct type S?;594
29.8.11;18.3.10 Static constructors;594
29.8.11.1;Static constructor roulette;595
30;Chapter 19: Arrays;597
30.1;19.1 Array types;597
30.1.1;19.1.1 The System.Array type;598
30.2;19.2 Array creation;598
30.3;19.3 Array element access;598
30.3.1;foreach: simpler and faster;598
30.4;19.4 Array members;599
30.4.1;Arrays and vectors on the CLI;599
30.5;19.5 Array covariance;600
30.6;19.6 Arrays and the generic IList interface;601
30.7;19.7 Array initializers;601
30.7.1;Brace depth must equal array dimension;603
31;Chapter 20: Interfaces;604
31.1;20.1 Interface declarations;604
31.1.1;Partial interfaces?;604
31.1.2;20.1.1 Interface modifiers;604
31.1.3;20.1.2 Base interfaces;605
31.1.3.1;Different inheritance;606
31.1.4;20.1.3 Interface body;606
31.2;20.2 Interface members;606
31.2.1;20.2.1 Interface methods;608
31.2.2;20.2.2 Interface properties;608
31.2.3;20.2.3 Interface events;608
31.2.4;20.2.4 Interface indexers;609
31.2.5;20.2.5 Interface member access;609
31.3;20.3 Fully qualified interface member names;611
31.4;20.4 Interface implementations;612
31.4.1;Interfaces implemented through the base class;612
31.4.2;20.4.1 Explicit interface member implementations;613
31.4.2.1;Excess accessors not allowed in explicit interface member implementation;614
31.4.2.2;Simulating return type covariance;615
31.4.2.3;params oddity;616
31.4.3;20.4.2 Interface mapping;616
31.4.3.1;Morphing non-virtual methods;618
31.4.3.2;Inaccurate assertion;619
31.4.4;20.4.3 Interface implementation inheritance;621
31.4.4.1;Erratum?;621
31.4.4.2;Meaning of ‘‘implements’’;621
31.4.5;20.4.4 Interface re-implementation;623
31.4.5.1;Original implementation inaccessible;624
31.4.6;20.4.5 Abstract classes and interfaces;626
31.4.6.1;Abstract class interface alternatives;626
32;Chapter 21: Enums;629
32.1;Enums are integral;629
32.2;21.1 Enum declarations;630
32.2.1;Why no char underlying type?;631
32.3;21.2 Enum modifiers;631
32.4;21.3 Enum members;631
32.4.1;Second-class citizens;632
32.4.2;Type of an enum member;632
32.4.3;enum alternatives;634
32.5;21.4 The System.Enum type;635
32.6;21.5 Enum values and operations;636
32.6.1;Operations on enums;636
33;Chapter 22: Delegates;637
33.1;22.1 Delegate declarations;637
33.2;22.2 Delegate instantiation;639
33.2.1;Creation does not trigger static initialization;640
33.2.2;Delegates for value type instance methods;641
33.2.3;The C# pimpernel…;642
33.3;22.3 Delegate invocation;642
34;Chapter 23: Exceptions;645
34.1;Exceptions not advised as control flow;645
34.2;23.1 Causes of exceptions;645
34.2.1;Asynchronous exceptions;646
34.2.2;Unexpected exception;646
34.3;23.2 The System.Exception class;646
34.3.1;Optional InnerException;646
34.3.2;A good idea in theory, but not in practice;647
34.4;23.3 How exceptions are handled;647
34.4.1;Here be dragons;648
34.5;23.4 Common exception classes;648
34.5.1;Genteel exception classes?;649
35;Chapter 24: Attributes;650
35.1;24.1 Attribute classes;650
35.1.1;Suffix omission clarification;650
35.1.2;24.1.1 Attribute usage;651
35.1.3;24.1.2 Positional and named parameters;652
35.1.4;24.1.3 Attribute parameter types;653
35.2;24.2 Attribute specification;653
35.2.1;return vs. @return;655
35.2.2;Specification omission;658
35.2.3;Multiple declaration unclarity;659
35.3;24.3 Attribute instances;660
35.3.1;24.3.1 Compilation of an attribute;660
35.3.1.1;Constructor not called at compile-time;661
35.3.2;24.3.2 Run-time retrieval of an attribute instance;661
35.3.2.1;Reflection not part of C# standard;662
35.4;24.4 Reserved attributes;662
35.4.1;24.4.1 The AttributeUsage attribute;662
35.4.1.1;AttributeUsage and partial compile-time checks;662
35.4.2;24.4.2 The Conditional attribute;663
35.4.2.1;24.4.2.1 Conditional methods;663
35.4.2.1.1;Derived surprises;663
35.4.2.2;24.4.2.2 Conditional attribute classes;667
35.4.3;24.4.3 The Obsolete attribute;668
35.4.3.1;What error parameter?;668
35.4.3.2;Really obsolete;668
36;Chapter 25: Generics;670
36.1;Not separate, just pragmatic;670
36.2;C# generics compared to Ada, C++, Haskell, Java 1.5…;670
36.3;25.1 Generic class declarations;672
36.3.1;No type parameters in constructor declarations, but type arguments in constructor invocations;672
36.3.2;Overloading on number of type parameters;673
36.3.3;25.1.1 Type parameters;673
36.3.3.1;Null comparison despite no conversion;674
36.3.4;25.1.2 The instance type;675
36.3.5;25.1.3 Members of generic classes;675
36.3.6;25.1.4 Static fields in generic classes;676
36.3.6.1;Non-identical twins;676
36.3.7;25.1.5 Static constructors in generic classes;677
36.3.8;25.1.6 Accessing protected members;678
36.3.9;25.1.7 Overloading in generic classes;678
36.3.9.1;Clarifications;679
36.3.10;25.1.8 Parameter array methods and type parameters;679
36.3.11;25.1.9 Overriding and generic classes;680
36.3.12;25.1.10 Operators in generic classes;680
36.3.12.1;No operators on constructed type;681
36.3.12.2;Ignored ambiguity;682
36.3.13;25.1.11 Nested types in generic classes;683
36.3.13.1;Thinking generically: containers;684
36.4;25.2 Generic struct declarations;686
36.4.1;Infinite chains of constructed types;686
36.5;25.3 Generic interface declarations;687
36.5.1;25.3.1 Uniqueness of implemented interfaces;687
36.5.2;25.3.2 Explicit interface member implementations;688
36.6;25.4 Generic delegate declarations;689
36.6.1;Generic function types;690
36.7;25.5 Constructed types;690
36.7.1;25.5.1 Type arguments;691
36.7.2;25.5.2 Open and closed types;692
36.7.3;25.5.3 Base classes and interfaces of a constructed type;692
36.7.4;25.5.4 Members of a constructed type;693
36.7.5;25.5.5 Accessibility of a constructed type;694
36.7.6;25.5.6 Conversions;694
36.7.7;25.5.7 Using alias directives;695
36.7.7.1;Aliases do not take type parameters;695
36.8;25.6 Generic methods;695
36.8.1;25.6.1 Generic method signatures;696
36.8.2;25.6.2 Virtual generic methods;696
36.8.3;25.6.3 Calling generic methods;698
36.8.3.1;Polymorphic recursion;699
36.8.4;25.6.4 Inference of type arguments;699
36.8.4.1;Specification bug;701
36.8.4.2;Parameter arrays;701
36.8.4.3;Limited inference;702
36.8.5;25.6.5 Using a generic method with a delegate;702
36.8.5.1;From generic method to delegate;702
36.8.6;25.6.6 No generic properties, events, indexers, operators, constructors, or finalizers;703
36.8.6.1;Rationale: no generic constructors, operators, properties, or indexers;703
36.9;25.7 Constraints;705
36.9.1;No nullable constraint;706
36.9.2;Using constraints to simulate Java wildcard types;707
36.9.3;Ineffective base class?;709
36.9.4;No “numeric” constraints;711
36.9.5;25.7.1 Satisfying constraints;713
36.9.6;25.7.2 Member lookup on type parameters;714
36.9.7;25.7.3 Type parameters and boxing;714
36.9.7.1;No cast, no box;716
36.9.7.2;Inherited constraints;717
36.9.8;25.7.4 Conversions involving type parameters;717
36.9.8.1;Thinking generically: algorithms;718
37;Chapter 26: Iterators;721
37.1;Growing pains;721
37.2;Coroutines allowed?;722
37.3;26.1 Iterator blocks;722
37.3.1;26.1.1 Enumerator interfaces;723
37.3.2;26.1.2 Enumerable interfaces;723
37.3.3;26.1.3 Yield type;723
37.3.4;26.1.4 This access;723
37.3.4.1;How many iterators does it take to enumerate?;723
37.3.4.2;Enumerating a data structure: iterators, handwritten enumerator, or visitor style?;725
37.4;26.2 Enumerator objects;728
37.4.1;Iterators, finally, lock and using;728
37.4.2;Obscure iterator and finally/lock/using interaction;729
37.4.3;26.2.1 The MoveNext method;730
37.4.3.1;Implicit yield break at end of iterator block;731
37.4.4;26.2.2 The Current property;731
37.4.5;26.2.3 The Dispose method;731
37.5;26.3 Enumerable objects;732
37.5.1;26.3.1 The GetEnumerator method;732
37.6;26.4 Implementation example;733
37.6.1;Anecdote: iterator blocks, generic parameters, and a bug;741
38;Chapter 27: Unsafe code;742
38.1;27.1 Unsafe contexts;742
38.2;27.2 Pointer types;745
38.2.1;Missing grammar rule;746
38.2.2;Volatile pointers;747
38.2.3;A confusing C# vs. C/C++ syntax difference;747
38.3;27.3 Fixed and moveable variables;748
38.4;27.4 Pointer conversions;749
38.5;27.5 Pointers in expressions;750
38.5.1;27.5.1 Pointer indirection;751
38.5.2;27.5.2 Pointer member access;751
38.5.3;27.5.3 Pointer element access;752
38.5.4;27.5.4 The address-of operator;753
38.5.4.1;No pointer-to-volatile;754
38.5.5;27.5.5 Pointer increment and decrement;754
38.5.6;27.5.6 Pointer arithmetic;755
38.5.7;27.5.7 Pointer comparison;756
38.5.8;27.5.8 The sizeof operator;756
38.6;27.6 The fixed statement;757
38.7;27.7 Stack allocation;760
38.7.1;The programmer does not always come first;762
38.8;27.8 Dynamic memory allocation;762
39;A: Grammar;765
39.1;A.1 Lexical grammar;765
39.1.1;A.1.1 Line terminators;765
39.1.2;A.1.2 White space;765
39.1.3;A.1.3 Comments;766
39.1.4;A.1.4 Tokens;766
39.1.5;A.1.5 Unicode escape sequences;767
39.1.6;A.1.6 Identifiers;767
39.1.7;A.1.7 Keywords;768
39.1.8;A.1.8 Literals;768
39.1.9;A.1.9 Operators and punctuators;770
39.1.10;A.1.10 Pre-processing directives;771
39.2;A.2 Syntactic grammar;773
39.2.1;A.2.1 Basic concepts;773
39.2.2;A.2.2 Types;774
39.2.3;A.2.3 Variables;775
39.2.4;A.2.4 Expressions;775
39.2.5;A.2.5 Statements;779
39.2.6;A.2.6 Classes;784
39.2.7;A.2.7 Structs;791
39.2.8;A.2.8 Arrays;791
39.2.9;A.2.9 Interfaces;792
39.2.10;A.2.10 Enums;793
39.2.11;A.2.11 Delegates;794
39.2.12;A.2.12 Attributes;794
39.2.13;A.2.13 Generics;795
39.3;A.3 Grammar extensions for unsafe code;797
40;B: Portability issues;800
40.1;B.1 Undefined behavior;800
40.2;B.2 Implementation-defined behavior;800
40.3;B.3 Unspecified behavior;801
40.4;B.4 Other Issues;801
41;C: Naming Guidelines;802
41.1;Naming guideline summary;802
42;D: Standard Library;803
43;E: Documentation Comments;814
43.1;E.1 Introduction;814
43.2;E.2 Recommended tags;815
43.2.1;E.2.1 ;816
43.2.2;E.2.2 ;816
43.2.3;E.2.3 ;817
43.2.4;E.2.4 ;817
43.2.5;E.2.5 ;818
43.2.6;E.2.6 ;819
43.2.7;E.2.7 ;819
43.2.8;E.2.8 ;820
43.2.9;E.2.9 ;820
43.2.10;E.2.10 ;821
43.2.11;E.2.11 ;821
43.2.12;E.2.12 ;822
43.2.13;E.2.13 ;822
43.2.14;E.2.14 ;823
43.2.15;E.2.15 ;823
43.2.16;E.2.16 ;823
43.2.17;E.2.17 ;824
43.3;E.3 Processing the documentation file;824
43.3.1;E.3.1 ID string format;825
43.3.2;E.3.2 ID string examples;826
43.4;E.4 An example;830
43.4.1;E.4.1 C# source code;830
43.4.2;E.4.2 Resulting XML;833
44;F: Bibliography;837
45;Index;838




