Home Page Icon
Home Page
Table of Contents for
Code Snippets
Close
Code Snippets
by Mark Michaelis
Essential C# 8.0, 7th Edition
Cover Page
About This eBook
Halftitle Page
Title Page
Copyright Page
Dedication Page
Contents at a Glance
Contents
Figures
Tables
Foreword
Preface
Acknowledgments
About the Author
1. Introducing C#
Hello, World
C# Syntax Fundamentals
Working with Variables
Console Input and Output
Managed Execution and the Common Language Infrastructure
Multiple .NET Frameworks
2. Data Types
Fundamental Numeric Types
More Fundamental Types
Conversions between Data Types
3. More with Data Types
Categories of Types
Declaring Types That Allow null
Implicitly Typed Local Variables
Tuples
Arrays
4. Operators and Flow Control
Operators
Introducing Flow Control
Code Blocks ({})
Code Blocks, Scopes, and Declaration Spaces
Boolean Expressions
Programming with null
Bitwise Operators (<<, >>, |, &, ^, ~)
Control Flow Statements, Continued
Jump Statements
C# Preprocessor Directives
Summary
5. Methods and Parameters
Calling a Method
Declaring a Method
The using Directive
Returns and Parameters on Main()
Advanced Method Parameters
Recursion
Method Overloading
Optional Parameters
Basic Error Handling with Exceptions
Summary
6. Classes
Declaring and Instantiating a Class
Instance Fields
Instance Methods
Using the this Keyword
Access Modifiers
Properties
Constructors
Non-Nullable Reference Type Properties with Constructors
Nullable Attributes
Deconstructors
Static Members
Extension Methods
Encapsulating the Data
Nested Classes
Partial Classes
Summary
7. Inheritance
Derivation
Overriding the Base Class
Abstract Classes
All Classes Derive from System.Object
Pattern Matching with the is Operator
Pattern Matching within a switch Expression
Avoid Pattern Matching When Polymorphism Is Possible
Summary
8. Interfaces
Introducing Interfaces
Polymorphism through Interfaces
Interface Implementation
Converting between the Implementing Class and Its Interfaces
Interface Inheritance
Multiple Interface Inheritance
Extension Methods on Interfaces
Versioning
Extension Methods versus Default Interface Members
Interfaces Compared with Abstract Classes
Interfaces Compared with Attributes
9. Value Types
Structs
Boxing
Enums
Summary
10. Well-Formed Types
Overriding object Members
Operator Overloading
Referencing Other Assemblies
Encapsulation of Types
Defining Namespaces
XML Comments
Garbage Collection
Resource Cleanup
Lazy Initialization
Summary
11. Exception Handling
Multiple Exception Types
Catching Exceptions
Rethrowing an Existing Exception
General Catch Block
Guidelines for Exception Handling
Defining Custom Exceptions
Rethrowing a Wrapped Exception
Summary
12. Generics
C# without Generics
Introducing Generic Types
Constraints
Generic Methods
Covariance and Contravariance
Generic Internals
Summary
13. Delegates and Lambda Expressions
Introducing Delegates
Declaring Delegate Types
Lambda Expressions
Statement Lambdas
Anonymous Methods
Delegates Do Not Have Structural Equality
Outer Variables
Expression Trees
Summary
14. Events
Coding the Publish–Subscribe Pattern with Multicast Delegates
Understanding Events
Summary
15. Collection Interfaces with Standard Query Operators
Collection Initializers
What Makes a Class a Collection: IEnumerable
Standard Query Operators
Anonymous Types with LINQ
Summary
16. LINQ with Query Expressions
Introducing Query Expressions
Query Expressions Are Just Method Invocations
Summary
17. Building Custom Collections
More Collection Interfaces
Primary Collection Classes
Providing an Indexer
Returning null or an Empty Collection
Iterators
Summary
18. Reflection, Attributes, and Dynamic Programming
Reflection
nameof Operator
Attributes
Programming with Dynamic Objects
Summary
19. Introducing Multithreading
Multithreading Basics
Asynchronous Tasks
Canceling a Task
Working with System.Threading
Summary
20. Programming the Task-Based Asynchronous Pattern
Synchronously Invoking a High-Latency Operation
Asynchronously Invoking a High-Latency Operation Using the TPL
The Task-Based Asynchronous Pattern with async and await
Introducing Asynchronous Return of ValueTask<T>
Asynchronous Streams
IAsyncDisposable and the await using Declaration and Statement
Using LINQ with IAsyncEnumerable
Returning void from an Asynchronous Method
Asynchronous Lambdas and Local Functions
Task Schedulers and the Synchronization Context
async/await with the Windows UI
Summary
21. Iterating in Parallel
Executing Loop Iterations in Parallel
Running LINQ Queries in Parallel
Summary
22. Thread Synchronization
Why Synchronization?
Timers
Summary
23. Platform Interoperability and Unsafe Code
Platform Invoke
Pointers and Addresses
Executing Unsafe Code via a Delegate
Summary
24. The Common Language Infrastructure
Defining the Common Language Infrastructure
CLI Implementations
.NET Standard
Base Class Library
C# Compilation to Machine Code
Runtime
Assemblies, Manifests, and Modules
Common Intermediate Language
Common Type System
Common Language Specification
Metadata
.NET Native and Ahead of Time Compilation
Summary
Index
Index of 8.0 Topics
Index of 7.0 Topics
Index of 6.0 Topics
Credits
Code Snippets
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Code Snippets
Next
Next Chapter
Code Snippets
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset