|
|
xvii | |
|
|
xix | |
Foreword |
|
xxi | |
Preface |
|
xxiii | |
Acknowledgments |
|
xxxv | |
About the Author |
|
xxxvii | |
|
|
1 | (44) |
|
|
2 | (11) |
|
|
13 | (9) |
|
|
22 | (4) |
|
|
26 | (8) |
|
Managed Execution and the Common Language Infrastructure |
|
|
34 | (5) |
|
|
39 | (6) |
|
|
45 | (36) |
|
Fundamental Numeric Types |
|
|
46 | (9) |
|
|
55 | (17) |
|
Conversions between Data Types |
|
|
72 | (9) |
|
|
81 | (40) |
|
|
81 | (3) |
|
Declaring Types That Allow null |
|
|
84 | (5) |
|
Implicitly Typed Local Variables |
|
|
89 | (3) |
|
|
92 | (6) |
|
|
98 | (23) |
|
4 Operators and Flow Control |
|
|
121 | (74) |
|
|
122 | (16) |
|
|
138 | (6) |
|
|
144 | (3) |
|
Code Blocks, Scopes, and Declaration Spaces |
|
|
147 | (2) |
|
|
149 | (6) |
|
|
155 | (7) |
|
Bitwise Operators (<<, >>, I, &, ˆ, ~) |
|
|
162 | (6) |
|
Control Flow Statements, Continued |
|
|
168 | (12) |
|
|
180 | (6) |
|
C# Preprocessor Directives |
|
|
186 | (7) |
|
|
193 | (2) |
|
|
195 | (60) |
|
|
196 | (7) |
|
|
203 | (6) |
|
|
209 | (5) |
|
Returns and Parameters on Main() |
|
|
214 | (3) |
|
Advanced Method Parameters |
|
|
217 | (12) |
|
|
229 | (2) |
|
|
231 | (3) |
|
|
234 | (5) |
|
Basic Error Handling with Exceptions |
|
|
239 | (14) |
|
|
253 | (2) |
|
|
255 | (80) |
|
Declaring and Instantiating a Class |
|
|
259 | (3) |
|
|
262 | (3) |
|
|
265 | (1) |
|
|
266 | (8) |
|
|
274 | (2) |
|
|
276 | (17) |
|
|
293 | (10) |
|
Non-Nullable Reference Type Properties with Constructors |
|
|
303 | (3) |
|
|
306 | (3) |
|
|
309 | (2) |
|
|
311 | (10) |
|
|
321 | (2) |
|
|
323 | (3) |
|
|
326 | (3) |
|
|
329 | (4) |
|
|
333 | (2) |
|
|
335 | (42) |
|
|
336 | (10) |
|
Overriding the Base Class |
|
|
346 | (11) |
|
|
357 | (6) |
|
All Classes Derive from System.Object |
|
|
363 | (2) |
|
Pattern Matching with the is Operator |
|
|
365 | (6) |
|
Pattern Matching within a switch Expression |
|
|
371 | (2) |
|
Avoid Pattern Matching When Polymorphism Is Possible |
|
|
373 | (1) |
|
|
374 | (3) |
|
|
377 | (40) |
|
|
378 | (2) |
|
Polymorphism through Interfaces |
|
|
380 | (4) |
|
|
384 | (6) |
|
Converting between the Implementing Class and Its Interfaces |
|
|
390 | (1) |
|
|
390 | (3) |
|
Multiple Interface Inheritance |
|
|
393 | (1) |
|
Extension Methods on Interfaces |
|
|
394 | (2) |
|
|
396 | (15) |
|
Extension Methods versus Default Interface Members |
|
|
411 | (2) |
|
Interfaces Compared with Abstract Classes |
|
|
413 | (2) |
|
Interfaces Compared with Attributes |
|
|
415 | (2) |
|
|
417 | (34) |
|
|
422 | (6) |
|
|
428 | (9) |
|
|
437 | (10) |
|
|
447 | (4) |
|
|
451 | (60) |
|
Overriding object Members |
|
|
451 | (13) |
|
|
464 | (8) |
|
Referencing Other Assemblies |
|
|
472 | (7) |
|
|
479 | (2) |
|
|
481 | (4) |
|
|
485 | (4) |
|
|
489 | (4) |
|
|
493 | (15) |
|
|
508 | (2) |
|
|
510 | (1) |
|
|
511 | (22) |
|
|
511 | (3) |
|
|
514 | (3) |
|
Rethrowing an Existing Exception |
|
|
517 | (1) |
|
|
518 | (1) |
|
Guidelines for Exception Handling |
|
|
519 | (4) |
|
Defining Custom Exceptions |
|
|
523 | (4) |
|
Rethrowing a Wrapped Exception |
|
|
527 | (3) |
|
|
530 | (3) |
|
|
533 | (54) |
|
|
534 | (5) |
|
Introducing Generic Types |
|
|
539 | (14) |
|
|
553 | (15) |
|
|
568 | (5) |
|
Covariance and Contravariance |
|
|
573 | (7) |
|
|
580 | (5) |
|
|
585 | (2) |
|
13 Delegates and Lambda Expressions |
|
|
587 | (38) |
|
|
588 | (4) |
|
|
592 | (8) |
|
|
600 | (1) |
|
|
601 | (5) |
|
|
606 | (2) |
|
Delegates Do Not Have Structural Equality |
|
|
608 | (3) |
|
|
611 | (5) |
|
|
616 | (7) |
|
|
623 | (2) |
|
|
625 | (28) |
|
Coding the Publish--Subscribe Pattern with Multicast Delegates |
|
|
626 | (15) |
|
|
641 | (10) |
|
|
651 | (2) |
|
15 Collection Interfaces with Standard Query Operators |
|
|
653 | (52) |
|
|
654 | (3) |
|
What Makes a Class a Collection: IEnumerable |
|
|
657 | (6) |
|
|
663 | (32) |
|
Anonymous Types with LINQ |
|
|
695 | (9) |
|
|
704 | (1) |
|
16 LINQ with Query Expressions |
|
|
705 | (22) |
|
Introducing Query Expressions |
|
|
706 | (18) |
|
Query Expressions Are Just Method Invocations |
|
|
724 | (2) |
|
|
726 | (1) |
|
17 Building Custom Collections |
|
|
727 | (42) |
|
More Collection Interfaces |
|
|
728 | (3) |
|
Primary Collection Classes |
|
|
731 | (19) |
|
|
750 | (3) |
|
Returning null or an Empty Collection |
|
|
753 | (1) |
|
|
753 | (15) |
|
|
768 | (1) |
|
18 Reflection, Attributes, and Dynamic Programming |
|
|
769 | (44) |
|
|
770 | (11) |
|
|
781 | (2) |
|
|
783 | (17) |
|
Programming with Dynamic Objects |
|
|
800 | (11) |
|
|
811 | (2) |
|
19 Introducing Multithreading |
|
|
813 | (40) |
|
|
815 | (7) |
|
|
822 | (21) |
|
|
843 | (7) |
|
Working with System. Threading |
|
|
850 | (1) |
|
|
851 | (2) |
|
20 Programming the Task-Based Asynchronous Pattern |
|
|
853 | (42) |
|
Synchronously Invoking a High-Latency Operation |
|
|
854 | (2) |
|
Asynchronously Invoking a High-Latency Operation Using the TPL |
|
|
856 | (5) |
|
The Task-Based Asynchronous Pattern with async and await |
|
|
861 | (6) |
|
Introducing Asynchronous Return of ValueTask<T> |
|
|
867 | (3) |
|
|
870 | (4) |
|
IAsyncDisposable and the await using Declaration and Statement |
|
|
874 | (1) |
|
Using LINQ with IAsyncEnumerable |
|
|
875 | (2) |
|
Returning void from an Asynchronous Method |
|
|
877 | (4) |
|
Asynchronous Lambdas and Local Functions |
|
|
881 | (6) |
|
Task Schedulers and the Synchronization Context |
|
|
887 | (3) |
|
async/await with the Windows UI |
|
|
890 | (3) |
|
|
893 | (2) |
|
|
895 | (18) |
|
Executing Loop Iterations in Parallel |
|
|
895 | (10) |
|
Running LINQ Queries in Parallel |
|
|
905 | (6) |
|
|
911 | (2) |
|
22 Thread Synchronization |
|
|
913 | (34) |
|
|
914 | (29) |
|
|
943 | (2) |
|
|
945 | (2) |
|
23 Platform Interoperability and Unsafe Code |
|
|
947 | (26) |
|
|
948 | (12) |
|
|
960 | (11) |
|
Executing Unsafe Code via a Delegate |
|
|
971 | (1) |
|
|
972 | (1) |
|
24 The Common Language Infrastructure |
|
|
973 | (22) |
|
Defining the Common Language Infrastructure |
|
|
974 | (1) |
|
|
975 | (3) |
|
|
978 | (1) |
|
|
979 | (1) |
|
C# Compilation to Machine Code |
|
|
979 | (3) |
|
|
982 | (4) |
|
Assemblies, Manifests, and Modules |
|
|
986 | (3) |
|
Common Intermediate Language |
|
|
989 | (1) |
|
|
990 | (1) |
|
Common Language Specification |
|
|
991 | (1) |
|
|
991 | (2) |
|
.NET Native and Ahead of Time Compilation |
|
|
993 | (1) |
|
|
993 | (2) |
Index |
|
995 | (44) |
Index of 8.0 Topics |
|
1039 | (2) |
Index of 7.0 Topics |
|
1041 | (2) |
Index of 6.0 Topics |
|
1043 | |