Mark Michaelis
Essential C# 8.0
Mark Michaelis
Essential C# 8.0
- Broschiertes Buch
- Merkliste
- Auf die Merkliste
- Bewerten Bewerten
- Teilen
- Produkt teilen
- Produkterinnerung
- Produkterinnerung
Essential C# 8.0 is a well-organized, no-fluff guide to C# 8.0 for programming students at all levels of experience. Reflecting the most important C# features, it will help students write code that's simple, powerful, robust, secure, and maintainable.
Author Mark Michaelis presents a comprehensive tutorial and reference for the entire C# language, including expert coverage of key C# 8.0 enhancements. He illustrates key C# constructs with succinct examples, and presents best-practice coding guidelines.
Andere Kunden interessierten sich auch für
- Jeff PottsCMIS and Apache Chemistry in Action62,99 €
- Boro SitnikovskiIntroducing Software Verification with Dafny Language25,99 €
- Shubham DubeyOptimized C# Open Authentication System in Net36,99 €
- Prudent NGAIPERA-DONGLearn C# with Unity: from beginner to game developer29,99 €
- Bohdan BorowikTheory of Digital Automata74,99 €
- Denis PanjutaLearning C# Through Small Projects41,99 €
- Kathrin BergComputergestützte Bestandserfassung und -planung61,90 €
-
-
-
Essential C# 8.0 is a well-organized, no-fluff guide to C# 8.0 for programming students at all levels of experience. Reflecting the most important C# features, it will help students write code that's simple, powerful, robust, secure, and maintainable.
Author Mark Michaelis presents a comprehensive tutorial and reference for the entire C# language, including expert coverage of key C# 8.0 enhancements. He illustrates key C# constructs with succinct examples, and presents best-practice coding guidelines.
Author Mark Michaelis presents a comprehensive tutorial and reference for the entire C# language, including expert coverage of key C# 8.0 enhancements. He illustrates key C# constructs with succinct examples, and presents best-practice coding guidelines.
Produktdetails
- Produktdetails
- Verlag: Addison-Wesley
- 7. Aufl.
- Seitenzahl: 1088
- Erscheinungstermin: 7. Januar 2021
- Englisch
- Abmessung: 230mm x 177mm x 38mm
- Gewicht: 1335g
- ISBN-13: 9780135972267
- ISBN-10: 0135972264
- Artikelnr.: 57062367
- Verlag: Addison-Wesley
- 7. Aufl.
- Seitenzahl: 1088
- Erscheinungstermin: 7. Januar 2021
- Englisch
- Abmessung: 230mm x 177mm x 38mm
- Gewicht: 1335g
- ISBN-13: 9780135972267
- ISBN-10: 0135972264
- Artikelnr.: 57062367
Mark Michaelis is the founder of IntelliTect, an innovative software architecture and development firm where he serves as the chief technical architect and trainer. He has also written numerous articles and books, is an adjunct professor at Eastern Washington University, founder of the Spokane .NET Users Group, and co-organizer of the annual TEDx Coeur d’Alene events. Mark has been a Microsoft Regional Director since 2007 and a Microsoft MVP for more than 25 years.
Figures xvii
Tables xix
Foreword xxi
Preface xxiii
Acknowledgments xxxv
About the Author xxxvii
Chapter 1: Introducing C# 1
Hello, World 2
C# Syntax Fundamentals 13
Working with Variables 22
Console Input and Output 26
Managed Execution and the Common Language Infrastructure 34
Multiple .NET Frameworks 39
Chapter 2: Data Types 45
Fundamental Numeric Types 46
More Fundamental Types 55
Conversions between Data Types 72
Chapter 3: More with Data Types 81
Categories of Types 81
Declaring Types That Allow null 84
Implicitly Typed Local Variables 89
Tuples 92
Arrays 98
Chapter 4: Operators and Flow Control 121
Operators 122
Introducing Flow Control 138
Code Blocks ({}) 144
Code Blocks, Scopes, and Declaration Spaces 147
Boolean Expressions 149
Programming with null 155
Bitwise Operators (, , &, ^, ~) 162
Control Flow Statements, Continued 168
Jump Statements 180
C# Preprocessor Directives 186
Summary 193
Chapter 5: Methods and Parameters 195
Calling a Method 196
Declaring a Method 203
The using Directive 209
Returns and Parameters on Main() 214
Advanced Method Parameters 217
Recursion 229
Method Overloading 231
Optional Parameters 234
Basic Error Handling with Exceptions 239
Summary 253
Chapter 6: Classes 255
Declaring and Instantiating a Class 259
Instance Fields 262
Instance Methods 265
Using the this Keyword 266
Access Modifiers 274
Properties 276
Constructors 293
Non-Nullable Reference Type Properties with Constructors 303
Nullable Attributes 306
Deconstructors 309
Static Members 311
Extension Methods 321
Encapsulating the Data 323
Nested Classes 326
Partial Classes 329
Summary 333
Chapter 7: Inheritance 335
Derivation 336
Overriding the Base Class 346
Abstract Classes 357
All Classes Derive from System.Object 363
Pattern Matching with the is Operator 365
Pattern Matching within a switch Expression 371
Avoid Pattern Matching When Polymorphism Is Possible 373
Summary 374
Chapter 8: Interfaces 377
Introducing Interfaces 378
Polymorphism through Interfaces 380
Interface Implementation 384
Converting between the Implementing Class and Its Interfaces 390
Interface Inheritance 390
Multiple Interface Inheritance 393
Extension Methods on Interfaces 394
Versioning 396
Extension Methods versus Default Interface Members 411
Interfaces Compared with Abstract Classes 413
Interfaces Compared with Attributes 415
Chapter 9: Value Types 417
Structs 422
Boxing 428
Enums 437
Summary 447
Chapter 10: Well-Formed Types 451
Overriding object Members 451
Operator Overloading 464
Referencing Other Assemblies 472
Encapsulation of Types 479
Defining Namespaces 481
XML Comments 485
Garbage Collection 489
Resource Cleanup 493
Lazy Initialization 508
Summary 510
Chapter 11: Exception Handling 511
Multiple Exception Types 511
Catching Exceptions 514
Rethrowing an Existing Exception 517
General Catch Block 518
Guidelines for Exception Handling 519
Defining Custom Exceptions 523
Rethrowing a Wrapped Exception 527
Summary 530
Chapter 12: Generics 533
C# without Generics 534
Introducing Generic Types 539
Constraints 553
Generic Methods 568
Covariance and Contravariance 573
Generic Internals 580
Summary 585
Chapter 13: Delegates and Lambda Expressions 587
Introducing Delegates 588
Declaring Delegate Types 592
Lambda Expressions 600
Statement Lambdas 601
Anonymous Methods 606
Delegates Do Not Have Structural Equality 608
Outer Variables 611
Expression Trees 616
Summary 623
Chapter 14: Events 625
Coding the Publish–Subscribe Pattern with Multicast Delegates 626
Understanding Events 641
Summary 651
Chapter 15: Collection Interfaces with Standard Query Operators 653
Collection Initializers 654
What Makes a Class a Collection: IEnumerable 657
Standard Query Operators 663
Anonymous Types with LINQ 695
Summary 704
Chapter 16: LINQ with Query Expressions 705
Introducing Query Expressions 706
Query Expressions Are Just Method Invocations 724
Summary 726
Chapter 17: Building Custom Collections 727
More Collection Interfaces 728
Primary Collection Classes 731
Providing an Indexer 750
Returning null or an Empty Collection 753
Iterators 753
Summary 768
Chapter 18: Reflection, Attributes, and Dynamic Programming 769
Reflection 770
nameof Operator 781
Attributes 783
Programming with Dynamic Objects 800
Summary 811
Chapter 19: Introducing Multithreading 813
Multithreading Basics 815
Asynchronous Tasks 822
Canceling a Task 843
Working with System.Threading 850
Summary 851
Chapter 20: Programming the Task-Based Asynchronous Pattern 853
Synchronously Invoking a High-Latency Operation 854
Asynchronously Invoking a High-Latency Operation Using the TPL 856
The Task-Based Asynchronous Pattern with async and await 861
Introducing Asynchronous Return of ValueTask 867
Asynchronous Streams 870
IAsyncDisposable and the await using Declaration and Statement 874
Using LINQ with IAsyncEnumerable 875
Returning void from an Asynchronous Method 877
Asynchronous Lambdas and Local Functions 881
Task Schedulers and the Synchronization Context 887
async/await with the Windows UI 890
Summary 893
Chapter 21: Iterating in Parallel 895
Executing Loop Iterations in Parallel 895
Running LINQ Queries in Parallel 905
Summary 911
Chapter 22: Thread Synchronization 913
Why Synchronization? 914
Timers 943
Summary 945
Chapter 23: Platform Interoperability and Unsafe Code 947
Platform Invoke 948
Pointers and Addresses 960
Executing Unsafe Code via a Delegate 971
Summary 972
Chapter 24: The Common Language Infrastructure 973
Defining the Common Language Infrastructure 974
CLI Implementations 975
.NET Standard 978
Base Class Library 979
C# Compilation to Machine Code 979
Runtime 982
Assemblies, Manifests, and Modules 986
Common Intermediate Language 989
Common Type System 990
Common Language Specification 991
Metadata 991
.NET Native and Ahead of Time Compilation 993
Summary 993
Index 995
Index of 8.0 Topics 1039
Index of 7.0 Topics 1041
Index of 6.0 Topics 1043
Tables xix
Foreword xxi
Preface xxiii
Acknowledgments xxxv
About the Author xxxvii
Chapter 1: Introducing C# 1
Hello, World 2
C# Syntax Fundamentals 13
Working with Variables 22
Console Input and Output 26
Managed Execution and the Common Language Infrastructure 34
Multiple .NET Frameworks 39
Chapter 2: Data Types 45
Fundamental Numeric Types 46
More Fundamental Types 55
Conversions between Data Types 72
Chapter 3: More with Data Types 81
Categories of Types 81
Declaring Types That Allow null 84
Implicitly Typed Local Variables 89
Tuples 92
Arrays 98
Chapter 4: Operators and Flow Control 121
Operators 122
Introducing Flow Control 138
Code Blocks ({}) 144
Code Blocks, Scopes, and Declaration Spaces 147
Boolean Expressions 149
Programming with null 155
Bitwise Operators (, , &, ^, ~) 162
Control Flow Statements, Continued 168
Jump Statements 180
C# Preprocessor Directives 186
Summary 193
Chapter 5: Methods and Parameters 195
Calling a Method 196
Declaring a Method 203
The using Directive 209
Returns and Parameters on Main() 214
Advanced Method Parameters 217
Recursion 229
Method Overloading 231
Optional Parameters 234
Basic Error Handling with Exceptions 239
Summary 253
Chapter 6: Classes 255
Declaring and Instantiating a Class 259
Instance Fields 262
Instance Methods 265
Using the this Keyword 266
Access Modifiers 274
Properties 276
Constructors 293
Non-Nullable Reference Type Properties with Constructors 303
Nullable Attributes 306
Deconstructors 309
Static Members 311
Extension Methods 321
Encapsulating the Data 323
Nested Classes 326
Partial Classes 329
Summary 333
Chapter 7: Inheritance 335
Derivation 336
Overriding the Base Class 346
Abstract Classes 357
All Classes Derive from System.Object 363
Pattern Matching with the is Operator 365
Pattern Matching within a switch Expression 371
Avoid Pattern Matching When Polymorphism Is Possible 373
Summary 374
Chapter 8: Interfaces 377
Introducing Interfaces 378
Polymorphism through Interfaces 380
Interface Implementation 384
Converting between the Implementing Class and Its Interfaces 390
Interface Inheritance 390
Multiple Interface Inheritance 393
Extension Methods on Interfaces 394
Versioning 396
Extension Methods versus Default Interface Members 411
Interfaces Compared with Abstract Classes 413
Interfaces Compared with Attributes 415
Chapter 9: Value Types 417
Structs 422
Boxing 428
Enums 437
Summary 447
Chapter 10: Well-Formed Types 451
Overriding object Members 451
Operator Overloading 464
Referencing Other Assemblies 472
Encapsulation of Types 479
Defining Namespaces 481
XML Comments 485
Garbage Collection 489
Resource Cleanup 493
Lazy Initialization 508
Summary 510
Chapter 11: Exception Handling 511
Multiple Exception Types 511
Catching Exceptions 514
Rethrowing an Existing Exception 517
General Catch Block 518
Guidelines for Exception Handling 519
Defining Custom Exceptions 523
Rethrowing a Wrapped Exception 527
Summary 530
Chapter 12: Generics 533
C# without Generics 534
Introducing Generic Types 539
Constraints 553
Generic Methods 568
Covariance and Contravariance 573
Generic Internals 580
Summary 585
Chapter 13: Delegates and Lambda Expressions 587
Introducing Delegates 588
Declaring Delegate Types 592
Lambda Expressions 600
Statement Lambdas 601
Anonymous Methods 606
Delegates Do Not Have Structural Equality 608
Outer Variables 611
Expression Trees 616
Summary 623
Chapter 14: Events 625
Coding the Publish–Subscribe Pattern with Multicast Delegates 626
Understanding Events 641
Summary 651
Chapter 15: Collection Interfaces with Standard Query Operators 653
Collection Initializers 654
What Makes a Class a Collection: IEnumerable 657
Standard Query Operators 663
Anonymous Types with LINQ 695
Summary 704
Chapter 16: LINQ with Query Expressions 705
Introducing Query Expressions 706
Query Expressions Are Just Method Invocations 724
Summary 726
Chapter 17: Building Custom Collections 727
More Collection Interfaces 728
Primary Collection Classes 731
Providing an Indexer 750
Returning null or an Empty Collection 753
Iterators 753
Summary 768
Chapter 18: Reflection, Attributes, and Dynamic Programming 769
Reflection 770
nameof Operator 781
Attributes 783
Programming with Dynamic Objects 800
Summary 811
Chapter 19: Introducing Multithreading 813
Multithreading Basics 815
Asynchronous Tasks 822
Canceling a Task 843
Working with System.Threading 850
Summary 851
Chapter 20: Programming the Task-Based Asynchronous Pattern 853
Synchronously Invoking a High-Latency Operation 854
Asynchronously Invoking a High-Latency Operation Using the TPL 856
The Task-Based Asynchronous Pattern with async and await 861
Introducing Asynchronous Return of ValueTask 867
Asynchronous Streams 870
IAsyncDisposable and the await using Declaration and Statement 874
Using LINQ with IAsyncEnumerable 875
Returning void from an Asynchronous Method 877
Asynchronous Lambdas and Local Functions 881
Task Schedulers and the Synchronization Context 887
async/await with the Windows UI 890
Summary 893
Chapter 21: Iterating in Parallel 895
Executing Loop Iterations in Parallel 895
Running LINQ Queries in Parallel 905
Summary 911
Chapter 22: Thread Synchronization 913
Why Synchronization? 914
Timers 943
Summary 945
Chapter 23: Platform Interoperability and Unsafe Code 947
Platform Invoke 948
Pointers and Addresses 960
Executing Unsafe Code via a Delegate 971
Summary 972
Chapter 24: The Common Language Infrastructure 973
Defining the Common Language Infrastructure 974
CLI Implementations 975
.NET Standard 978
Base Class Library 979
C# Compilation to Machine Code 979
Runtime 982
Assemblies, Manifests, and Modules 986
Common Intermediate Language 989
Common Type System 990
Common Language Specification 991
Metadata 991
.NET Native and Ahead of Time Compilation 993
Summary 993
Index 995
Index of 8.0 Topics 1039
Index of 7.0 Topics 1041
Index of 6.0 Topics 1043
Figures xvii
Tables xix
Foreword xxi
Preface xxiii
Acknowledgments xxxv
About the Author xxxvii
Chapter 1: Introducing C# 1
Hello, World 2
C# Syntax Fundamentals 13
Working with Variables 22
Console Input and Output 26
Managed Execution and the Common Language Infrastructure 34
Multiple .NET Frameworks 39
Chapter 2: Data Types 45
Fundamental Numeric Types 46
More Fundamental Types 55
Conversions between Data Types 72
Chapter 3: More with Data Types 81
Categories of Types 81
Declaring Types That Allow null 84
Implicitly Typed Local Variables 89
Tuples 92
Arrays 98
Chapter 4: Operators and Flow Control 121
Operators 122
Introducing Flow Control 138
Code Blocks ({}) 144
Code Blocks, Scopes, and Declaration Spaces 147
Boolean Expressions 149
Programming with null 155
Bitwise Operators (, , &, ^, ~) 162
Control Flow Statements, Continued 168
Jump Statements 180
C# Preprocessor Directives 186
Summary 193
Chapter 5: Methods and Parameters 195
Calling a Method 196
Declaring a Method 203
The using Directive 209
Returns and Parameters on Main() 214
Advanced Method Parameters 217
Recursion 229
Method Overloading 231
Optional Parameters 234
Basic Error Handling with Exceptions 239
Summary 253
Chapter 6: Classes 255
Declaring and Instantiating a Class 259
Instance Fields 262
Instance Methods 265
Using the this Keyword 266
Access Modifiers 274
Properties 276
Constructors 293
Non-Nullable Reference Type Properties with Constructors 303
Nullable Attributes 306
Deconstructors 309
Static Members 311
Extension Methods 321
Encapsulating the Data 323
Nested Classes 326
Partial Classes 329
Summary 333
Chapter 7: Inheritance 335
Derivation 336
Overriding the Base Class 346
Abstract Classes 357
All Classes Derive from System.Object 363
Pattern Matching with the is Operator 365
Pattern Matching within a switch Expression 371
Avoid Pattern Matching When Polymorphism Is Possible 373
Summary 374
Chapter 8: Interfaces 377
Introducing Interfaces 378
Polymorphism through Interfaces 380
Interface Implementation 384
Converting between the Implementing Class and Its Interfaces 390
Interface Inheritance 390
Multiple Interface Inheritance 393
Extension Methods on Interfaces 394
Versioning 396
Extension Methods versus Default Interface Members 411
Interfaces Compared with Abstract Classes 413
Interfaces Compared with Attributes 415
Chapter 9: Value Types 417
Structs 422
Boxing 428
Enums 437
Summary 447
Chapter 10: Well-Formed Types 451
Overriding object Members 451
Operator Overloading 464
Referencing Other Assemblies 472
Encapsulation of Types 479
Defining Namespaces 481
XML Comments 485
Garbage Collection 489
Resource Cleanup 493
Lazy Initialization 508
Summary 510
Chapter 11: Exception Handling 511
Multiple Exception Types 511
Catching Exceptions 514
Rethrowing an Existing Exception 517
General Catch Block 518
Guidelines for Exception Handling 519
Defining Custom Exceptions 523
Rethrowing a Wrapped Exception 527
Summary 530
Chapter 12: Generics 533
C# without Generics 534
Introducing Generic Types 539
Constraints 553
Generic Methods 568
Covariance and Contravariance 573
Generic Internals 580
Summary 585
Chapter 13: Delegates and Lambda Expressions 587
Introducing Delegates 588
Declaring Delegate Types 592
Lambda Expressions 600
Statement Lambdas 601
Anonymous Methods 606
Delegates Do Not Have Structural Equality 608
Outer Variables 611
Expression Trees 616
Summary 623
Chapter 14: Events 625
Coding the Publish–Subscribe Pattern with Multicast Delegates 626
Understanding Events 641
Summary 651
Chapter 15: Collection Interfaces with Standard Query Operators 653
Collection Initializers 654
What Makes a Class a Collection: IEnumerable 657
Standard Query Operators 663
Anonymous Types with LINQ 695
Summary 704
Chapter 16: LINQ with Query Expressions 705
Introducing Query Expressions 706
Query Expressions Are Just Method Invocations 724
Summary 726
Chapter 17: Building Custom Collections 727
More Collection Interfaces 728
Primary Collection Classes 731
Providing an Indexer 750
Returning null or an Empty Collection 753
Iterators 753
Summary 768
Chapter 18: Reflection, Attributes, and Dynamic Programming 769
Reflection 770
nameof Operator 781
Attributes 783
Programming with Dynamic Objects 800
Summary 811
Chapter 19: Introducing Multithreading 813
Multithreading Basics 815
Asynchronous Tasks 822
Canceling a Task 843
Working with System.Threading 850
Summary 851
Chapter 20: Programming the Task-Based Asynchronous Pattern 853
Synchronously Invoking a High-Latency Operation 854
Asynchronously Invoking a High-Latency Operation Using the TPL 856
The Task-Based Asynchronous Pattern with async and await 861
Introducing Asynchronous Return of ValueTask 867
Asynchronous Streams 870
IAsyncDisposable and the await using Declaration and Statement 874
Using LINQ with IAsyncEnumerable 875
Returning void from an Asynchronous Method 877
Asynchronous Lambdas and Local Functions 881
Task Schedulers and the Synchronization Context 887
async/await with the Windows UI 890
Summary 893
Chapter 21: Iterating in Parallel 895
Executing Loop Iterations in Parallel 895
Running LINQ Queries in Parallel 905
Summary 911
Chapter 22: Thread Synchronization 913
Why Synchronization? 914
Timers 943
Summary 945
Chapter 23: Platform Interoperability and Unsafe Code 947
Platform Invoke 948
Pointers and Addresses 960
Executing Unsafe Code via a Delegate 971
Summary 972
Chapter 24: The Common Language Infrastructure 973
Defining the Common Language Infrastructure 974
CLI Implementations 975
.NET Standard 978
Base Class Library 979
C# Compilation to Machine Code 979
Runtime 982
Assemblies, Manifests, and Modules 986
Common Intermediate Language 989
Common Type System 990
Common Language Specification 991
Metadata 991
.NET Native and Ahead of Time Compilation 993
Summary 993
Index 995
Index of 8.0 Topics 1039
Index of 7.0 Topics 1041
Index of 6.0 Topics 1043
Tables xix
Foreword xxi
Preface xxiii
Acknowledgments xxxv
About the Author xxxvii
Chapter 1: Introducing C# 1
Hello, World 2
C# Syntax Fundamentals 13
Working with Variables 22
Console Input and Output 26
Managed Execution and the Common Language Infrastructure 34
Multiple .NET Frameworks 39
Chapter 2: Data Types 45
Fundamental Numeric Types 46
More Fundamental Types 55
Conversions between Data Types 72
Chapter 3: More with Data Types 81
Categories of Types 81
Declaring Types That Allow null 84
Implicitly Typed Local Variables 89
Tuples 92
Arrays 98
Chapter 4: Operators and Flow Control 121
Operators 122
Introducing Flow Control 138
Code Blocks ({}) 144
Code Blocks, Scopes, and Declaration Spaces 147
Boolean Expressions 149
Programming with null 155
Bitwise Operators (, , &, ^, ~) 162
Control Flow Statements, Continued 168
Jump Statements 180
C# Preprocessor Directives 186
Summary 193
Chapter 5: Methods and Parameters 195
Calling a Method 196
Declaring a Method 203
The using Directive 209
Returns and Parameters on Main() 214
Advanced Method Parameters 217
Recursion 229
Method Overloading 231
Optional Parameters 234
Basic Error Handling with Exceptions 239
Summary 253
Chapter 6: Classes 255
Declaring and Instantiating a Class 259
Instance Fields 262
Instance Methods 265
Using the this Keyword 266
Access Modifiers 274
Properties 276
Constructors 293
Non-Nullable Reference Type Properties with Constructors 303
Nullable Attributes 306
Deconstructors 309
Static Members 311
Extension Methods 321
Encapsulating the Data 323
Nested Classes 326
Partial Classes 329
Summary 333
Chapter 7: Inheritance 335
Derivation 336
Overriding the Base Class 346
Abstract Classes 357
All Classes Derive from System.Object 363
Pattern Matching with the is Operator 365
Pattern Matching within a switch Expression 371
Avoid Pattern Matching When Polymorphism Is Possible 373
Summary 374
Chapter 8: Interfaces 377
Introducing Interfaces 378
Polymorphism through Interfaces 380
Interface Implementation 384
Converting between the Implementing Class and Its Interfaces 390
Interface Inheritance 390
Multiple Interface Inheritance 393
Extension Methods on Interfaces 394
Versioning 396
Extension Methods versus Default Interface Members 411
Interfaces Compared with Abstract Classes 413
Interfaces Compared with Attributes 415
Chapter 9: Value Types 417
Structs 422
Boxing 428
Enums 437
Summary 447
Chapter 10: Well-Formed Types 451
Overriding object Members 451
Operator Overloading 464
Referencing Other Assemblies 472
Encapsulation of Types 479
Defining Namespaces 481
XML Comments 485
Garbage Collection 489
Resource Cleanup 493
Lazy Initialization 508
Summary 510
Chapter 11: Exception Handling 511
Multiple Exception Types 511
Catching Exceptions 514
Rethrowing an Existing Exception 517
General Catch Block 518
Guidelines for Exception Handling 519
Defining Custom Exceptions 523
Rethrowing a Wrapped Exception 527
Summary 530
Chapter 12: Generics 533
C# without Generics 534
Introducing Generic Types 539
Constraints 553
Generic Methods 568
Covariance and Contravariance 573
Generic Internals 580
Summary 585
Chapter 13: Delegates and Lambda Expressions 587
Introducing Delegates 588
Declaring Delegate Types 592
Lambda Expressions 600
Statement Lambdas 601
Anonymous Methods 606
Delegates Do Not Have Structural Equality 608
Outer Variables 611
Expression Trees 616
Summary 623
Chapter 14: Events 625
Coding the Publish–Subscribe Pattern with Multicast Delegates 626
Understanding Events 641
Summary 651
Chapter 15: Collection Interfaces with Standard Query Operators 653
Collection Initializers 654
What Makes a Class a Collection: IEnumerable 657
Standard Query Operators 663
Anonymous Types with LINQ 695
Summary 704
Chapter 16: LINQ with Query Expressions 705
Introducing Query Expressions 706
Query Expressions Are Just Method Invocations 724
Summary 726
Chapter 17: Building Custom Collections 727
More Collection Interfaces 728
Primary Collection Classes 731
Providing an Indexer 750
Returning null or an Empty Collection 753
Iterators 753
Summary 768
Chapter 18: Reflection, Attributes, and Dynamic Programming 769
Reflection 770
nameof Operator 781
Attributes 783
Programming with Dynamic Objects 800
Summary 811
Chapter 19: Introducing Multithreading 813
Multithreading Basics 815
Asynchronous Tasks 822
Canceling a Task 843
Working with System.Threading 850
Summary 851
Chapter 20: Programming the Task-Based Asynchronous Pattern 853
Synchronously Invoking a High-Latency Operation 854
Asynchronously Invoking a High-Latency Operation Using the TPL 856
The Task-Based Asynchronous Pattern with async and await 861
Introducing Asynchronous Return of ValueTask 867
Asynchronous Streams 870
IAsyncDisposable and the await using Declaration and Statement 874
Using LINQ with IAsyncEnumerable 875
Returning void from an Asynchronous Method 877
Asynchronous Lambdas and Local Functions 881
Task Schedulers and the Synchronization Context 887
async/await with the Windows UI 890
Summary 893
Chapter 21: Iterating in Parallel 895
Executing Loop Iterations in Parallel 895
Running LINQ Queries in Parallel 905
Summary 911
Chapter 22: Thread Synchronization 913
Why Synchronization? 914
Timers 943
Summary 945
Chapter 23: Platform Interoperability and Unsafe Code 947
Platform Invoke 948
Pointers and Addresses 960
Executing Unsafe Code via a Delegate 971
Summary 972
Chapter 24: The Common Language Infrastructure 973
Defining the Common Language Infrastructure 974
CLI Implementations 975
.NET Standard 978
Base Class Library 979
C# Compilation to Machine Code 979
Runtime 982
Assemblies, Manifests, and Modules 986
Common Intermediate Language 989
Common Type System 990
Common Language Specification 991
Metadata 991
.NET Native and Ahead of Time Compilation 993
Summary 993
Index 995
Index of 8.0 Topics 1039
Index of 7.0 Topics 1041
Index of 6.0 Topics 1043