0%

When you have questions about C# 9.0 or .NET 5, this best-selling guide has the answers you need. C# is a language of unusual flexibility and breadth, but with its continual growth there's so much more to learn. In the tradition of O'Reilly's Nutshell guides, this thoroughly updated edition is simply the best one-volume reference to the C# language available today.

Organized around concepts and use cases, C# 9.0 in a Nutshell provides intermediate and advanced programmers with a concise map of C# and .NET that also plumbs significant depths.

  • Get up to speed on C#, from syntax and variables to advanced topics such as pointers, records, closures, and patterns
  • Dig deep into LINQ with three chapters dedicated to the topic
  • Explore concurrency and asynchrony, advanced threading, and parallel programming
  • Work with .NET features, including regular expressions, networking, spans, reflection, and cryptography

Table of Contents

  1. Preface
    1. Intended Audience
    2. How This Book Is Organized
    3. What You Need to Use This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. We’d Like to Hear from You
    7. O’Reilly Online Learning
    8. Acknowledgments
  2. 1. Introducing C# and .NET
    1. Object Orientation
    2. Type Safety
    3. Memory Management
    4. Platform Support
    5. CLRs, BCLs, and Runtimes
    6. Common Language Runtime
    7. Base Class Library
    8. Runtimes
    9. Legacy and Niche Runtimes
    10. A Brief History of C#
    11. What’s New in C# 9.0
    12. What’s New in C# 8.0
    13. What’s New in C# 7.x
    14. What’s New in C# 6.0
    15. What’s New in C# 5.0
    16. What’s New in C# 4.0
    17. What’s New in C# 3.0
    18. What’s New in C# 2.0
  3. 2. C# Language Basics
    1. A First C# Program
    2. Compilation
    3. Syntax
    4. Identifiers and Keywords
    5. Literals, Punctuators, and Operators
    6. Comments
    7. Type Basics
    8. Predefined Type Examples
    9. Custom Types
    10. Types and Conversions
    11. Value Types Versus Reference Types
    12. Predefined Type Taxonomy
    13. Numeric Types
    14. Numeric Literals
    15. Numeric Conversions
    16. Arithmetic Operators
    17. Increment and Decrement Operators
    18. Specialized Operations on Integral Types
    19. 8- and 16-Bit Integral Types
    20. Native-Sized Integers (C# 9)
    21. Special Float and Double Values
    22. double Versus decimal
    23. Real Number Rounding Errors
    24. Boolean Type and Operators
    25. bool Conversions
    26. Equality and Comparison Operators
    27. Conditional Operators
    28. Strings and Characters
    29. Char Conversions
    30. String Type
    31. Arrays
    32. Default Element Initialization
    33. Indices and Ranges
    34. Multidimensional Arrays
    35. Simplified Array Initialization Expressions
    36. Bounds Checking
    37. Variables and Parameters
    38. The Stack and the Heap
    39. Definite Assignment
    40. Default Values
    41. Parameters
    42. Ref Locals
    43. Ref Returns
    44. var—Implicitly Typed Local Variables
    45. Target-Typed new Expressions (C# 9)
    46. Expressions and Operators
    47. Primary Expressions
    48. Void Expressions
    49. Assignment Expressions
    50. Operator Precedence and Associativity
    51. Operator Table
    52. Null Operators
    53. Null-Coalescing Operator
    54. Null-Coalescing Assignment Operator
    55. Null-Conditional Operator
    56. Statements
    57. Declaration Statements
    58. Expression Statements
    59. Selection Statements
    60. Iteration Statements
    61. Jump Statements
    62. Miscellaneous Statements
    63. Namespaces
    64. The using Directive
    65. using static
    66. Rules Within a Namespace
    67. Aliasing Types and Namespaces
    68. Advanced Namespace Features
  4. 3. Creating Types in C#
    1. Classes
    2. Fields
    3. Constants
    4. Methods
    5. Instance Constructors
    6. Deconstructors
    7. Object Initializers
    8. The this Reference
    9. Properties
    10. Indexers
    11. Static Constructors
    12. Static Classes
    13. Finalizers
    14. Partial Types and Methods
    15. The nameof operator
    16. Inheritance
    17. Polymorphism
    18. Casting and Reference Conversions
    19. Virtual Function Members
    20. Abstract Classes and Abstract Members
    21. Hiding Inherited Members
    22. Sealing Functions and Classes
    23. The base Keyword
    24. Constructors and Inheritance
    25. Overloading and Resolution
    26. The object Type
    27. Boxing and Unboxing
    28. Static and Runtime Type Checking
    29. The GetType Method and typeof Operator
    30. The ToString Method
    31. Object Member Listing
    32. Structs
    33. Struct Construction Semantics
    34. Read-Only Structs and Functions
    35. Ref Structs
    36. Access Modifiers
    37. Examples
    38. Friend Assemblies
    39. Accessibility Capping
    40. Restrictions on Access Modifiers
    41. Interfaces
    42. Extending an Interface
    43. Explicit Interface Implementation
    44. Implementing Interface Members Virtually
    45. Reimplementing an Interface in a Subclass
    46. Interfaces and Boxing
    47. Default Interface Members
    48. Enums
    49. Enum Conversions
    50. Flags Enums
    51. Enum Operators
    52. Type-Safety Issues
    53. Nested Types
    54. Generics
    55. Generic Types
    56. Why Generics Exist
    57. Generic Methods
    58. Declaring Type Parameters
    59. typeof and Unbound Generic Types
    60. The default Generic Value
    61. Generic Constraints
    62. Subclassing Generic Types
    63. Self-Referencing Generic Declarations
    64. Static Data
    65. Type Parameters and Conversions
    66. Covariance
    67. Contravariance
    68. C# Generics Versus C++ Templates
  5. 4. Advanced C#
    1. Delegates
    2. Writing Plug-in Methods with Delegates
    3. Instance and Static Method Targets
    4. Multicast Delegates
    5. Generic Delegate Types
    6. The Func and Action Delegates
    7. Delegates Versus Interfaces
    8. Delegate Compatibility
    9. Events
    10. Standard Event Pattern
    11. Event Accessors
    12. Event Modifiers
    13. Lambda Expressions
    14. Explicitly Specifying Lambda Parameter Types
    15. Capturing Outer Variables
    16. Lambda Expressions Versus Local Methods
    17. Anonymous Methods
    18. try Statements and Exceptions
    19. The catch Clause
    20. The finally Block
    21. Throwing Exceptions
    22. Key Properties of System.Exception
    23. Common Exception Types
    24. The TryXXX Method Pattern
    25. Alternatives to Exceptions
    26. Enumeration and Iterators
    27. Enumeration
    28. Collection Initializers
    29. Iterators
    30. Iterator Semantics
    31. Composing Sequences
    32. Nullable Value Types
    33. Nullable<T> Struct
    34. Implicit and Explicit Nullable Conversions
    35. Boxing and Unboxing Nullable Values
    36. Operator Lifting
    37. bool? with & and | Operators
    38. Nullable Value Types and Null Operators
    39. Scenarios for Nullable Value Types
    40. Alternatives to Nullable Value Types
    41. Nullable Reference Types
    42. The Null-Forgiving Operator
    43. Separating the Annotation and Warning Contexts
    44. Treating Nullable Warnings as Errors
    45. Extension Methods
    46. Extension Method Chaining
    47. Ambiguity and Resolution
    48. Anonymous Types
    49. Tuples
    50. Naming Tuple Elements
    51. ValueTuple.Create
    52. Deconstructing Tuples
    53. Equality Comparison
    54. The System.Tuple classes
    55. Records (C# 9)
    56. Background
    57. Defining a Record
    58. Nondestructive Mutation
    59. Property Validation
    60. Calculated Fields and Lazy Evaluation
    61. Primary Constructors
    62. Records and Equality Comparison
    63. Patterns
    64. var Pattern
    65. Constant Pattern
    66. Relational Patterns (C# 9)
    67. Pattern Combinators (C# 9)
    68. Tuple and Positional Patterns
    69. Property Patterns
    70. Attributes
    71. Attribute Classes
    72. Named and Positional Attribute Parameters
    73. Applying Attributes to Assemblies and Backing Fields
    74. Specifying Multiple Attributes
    75. Caller Info Attributes
    76. Dynamic Binding
    77. Static Binding Versus Dynamic Binding
    78. Custom Binding
    79. Language Binding
    80. RuntimeBinderException
    81. Runtime Representation of Dynamic
    82. Dynamic Conversions
    83. var Versus dynamic
    84. Dynamic Expressions
    85. Dynamic Calls Without Dynamic Receivers
    86. Static Types in Dynamic Expressions
    87. Uncallable Functions
    88. Operator Overloading
    89. Operator Functions
    90. Overloading Equality and Comparison Operators
    91. Custom Implicit and Explicit Conversions
    92. Overloading true and false
    93. Unsafe Code and Pointers
    94. Pointer Basics
    95. Unsafe Code
    96. The fixed Statement
    97. The Pointer-to-Member Operator
    98. The stackalloc Keyword
    99. Fixed-Size Buffers
    100. void*
    101. Function Pointers (C# 9)
    102. [SkipLocalsInit] (C# 9)
    103. Preprocessor Directives
    104. Conditional Attributes
    105. Pragma Warning
    106. XML Documentation
    107. Standard XML Documentation Tags
    108. User-Defined Tags
    109. Type or Member Cross-References
  6. 5. .NET Overview
    1. .NET Standard
    2. .NET Standard 2.0
    3. .NET Standard 2.1
    4. Older .NET Standards
    5. .NET Framework and .NET 5 Compatibility
    6. Runtime and C# Language Versions
    7. Reference Assemblies
    8. The CLR and BCL
    9. System Types
    10. Text Processing
    11. Collections
    12. Querying
    13. XML and JSON
    14. Diagnostics
    15. Concurrency and Asynchrony
    16. Streams and Input/Output
    17. Networking
    18. Assemblies, Reflection, and Attributes
    19. Dynamic Programming
    20. Cryptography
    21. Advanced Threading
    22. Parallel Programming
    23. Span<T> and Memory<T>
    24. Native and COM Interoperability
    25. Regular Expressions
    26. Serialization
    27. The Roslyn Compiler
    28. Application Layers
    29. ASP.NET Core
    30. Windows Desktop
    31. UWP and WinUI 3
    32. Xamarin and Xamarin Forms
  7. 6. .NET Fundamentals
    1. String and Text Handling
    2. Char
    3. String
    4. Comparing Strings
    5. StringBuilder
    6. Text Encodings and Unicode
    7. Dates and Times
    8. TimeSpan
    9. DateTime and DateTimeOffset
    10. Dates and Time Zones
    11. DateTime and Time Zones
    12. DateTimeOffset and Time Zones
    13. TimeZoneInfo
    14. Daylight Saving Time and DateTime
    15. Formatting and Parsing
    16. ToString and Parse
    17. Format Providers
    18. Standard Format Strings and Parsing Flags
    19. Numeric Format Strings
    20. NumberStyles
    21. Date/Time Format Strings
    22. DateTimeStyles
    23. Enum Format Strings
    24. Other Conversion Mechanisms
    25. Convert
    26. XmlConvert
    27. Type Converters
    28. BitConverter
    29. Globalization
    30. Globalization Checklist
    31. Testing
    32. Working with Numbers
    33. Conversions
    34. Math
    35. BigInteger
    36. Half
    37. Complex
    38. Random
    39. Enums
    40. Enum Conversions
    41. Enumerating Enum Values
    42. How Enums Work
    43. The Guid Struct
    44. Equality Comparison
    45. Value Versus Referential Equality
    46. Standard Equality Protocols
    47. Equality and Custom Types
    48. Order Comparison
    49. IComparable
    50. < and >
    51. Implementing the IComparable Interfaces
    52. Utility Classes
    53. Console
    54. Environment
    55. Process
    56. AppContext
  8. 7. Collections
    1. Enumeration
    2. IEnumerable and IEnumerator
    3. IEnumerable<T> and IEnumerator<T>
    4. Implementing the Enumeration Interfaces
    5. The ICollection and IList Interfaces
    6. ICollection<T> and ICollection
    7. IList<T> and IList
    8. IReadOnlyCollection<T> and IReadOnlyList<T>
    9. The Array Class
    10. Construction and Indexing
    11. Enumeration
    12. Length and Rank
    13. Searching
    14. Sorting
    15. Reversing Elements
    16. Copying
    17. Converting and Resizing
    18. Lists, Queues, Stacks, and Sets
    19. List<T> and ArrayList
    20. LinkedList<T>
    21. Queue<T> and Queue
    22. Stack<T> and Stack
    23. BitArray
    24. HashSet<T> and SortedSet<T>
    25. Dictionaries
    26. IDictionary<TKey,TValue>
    27. IDictionary
    28. Dictionary<TKey,TValue> and Hashtable
    29. OrderedDictionary
    30. ListDictionary and HybridDictionary
    31. Sorted Dictionaries
    32. Customizable Collections and Proxies
    33. Collection<T> and CollectionBase
    34. KeyedCollection<TKey,TItem> and DictionaryBase
    35. ReadOnlyCollection<T>
    36. Immutable Collections
    37. Creating Immutable Collections
    38. Manipulating Immutable Collections
    39. Builders
    40. Immutable Collections and Performance
    41. Plugging in Equality and Order
    42. IEqualityComparer and EqualityComparer
    43. IComparer and Comparer
    44. StringComparer
    45. IStructuralEquatable and IStructuralComparable
  9. 8. LINQ Queries
    1. Getting Started
    2. Fluent Syntax
    3. Chaining Query Operators
    4. Composing Lambda Expressions
    5. Natural Ordering
    6. Other Operators
    7. Query Expressions
    8. Range Variables
    9. Query Syntax Versus SQL Syntax
    10. Query Syntax Versus Fluent Syntax
    11. Mixed-Syntax Queries
    12. Deferred Execution
    13. Reevaluation
    14. Captured Variables
    15. How Deferred Execution Works
    16. Chaining Decorators
    17. How Queries Are Executed
    18. Subqueries
    19. Subqueries and Deferred Execution
    20. Composition Strategies
    21. Progressive Query Building
    22. The into Keyword
    23. Wrapping Queries
    24. Projection Strategies
    25. Object Initializers
    26. Anonymous Types
    27. The let Keyword
    28. Interpreted Queries
    29. How Interpreted Queries Work
    30. Combining Interpreted and Local Queries
    31. AsEnumerable
    32. EF Core
    33. EF Core Entity Classes
    34. DbContext
    35. Object Tracking
    36. Change Tracking
    37. Navigation Properties
    38. Deferred Execution
    39. Building Query Expressions
    40. Delegates Versus Expression Trees
    41. Expression Trees
  10. 9. LINQ Operators
    1. Overview
    2. Sequence→Sequence
    3. Sequence→Element or Value
    4. Void→Sequence
    5. Filtering
    6. Where
    7. Take and Skip
    8. TakeWhile and SkipWhile
    9. Distinct
    10. Projecting
    11. Select
    12. SelectMany
    13. Joining
    14. Join and GroupJoin
    15. The Zip Operator
    16. Ordering
    17. OrderBy, OrderByDescending, ThenBy, and ThenByDescending
    18. Grouping
    19. GroupBy
    20. Set Operators
    21. Concat and Union
    22. Intersect and Except
    23. Conversion Methods
    24. OfType and Cast
    25. ToArray, ToList, ToDictionary, ToHashSet, and ToLookup
    26. AsEnumerable and AsQueryable
    27. Element Operators
    28. First, Last, and Single
    29. ElementAt
    30. DefaultIfEmpty
    31. Aggregation Methods
    32. Count and LongCount
    33. Min and Max
    34. Sum and Average
    35. Aggregate
    36. Quantifiers
    37. Contains and Any
    38. All and SequenceEqual
    39. Generation Methods
    40. Empty
    41. Range and Repeat
  11. 10. LINQ to XML
    1. Architectural Overview
    2. What Is a DOM?
    3. The LINQ to XML DOM
    4. X-DOM Overview
    5. Loading and Parsing
    6. Saving and Serializing
    7. Instantiating an X-DOM
    8. Functional Construction
    9. Specifying Content
    10. Automatic Deep Cloning
    11. Navigating and Querying
    12. Child Node Navigation
    13. Parent Navigation
    14. Peer Node Navigation
    15. Attribute Navigation
    16. Updating an X-DOM
    17. Simple Value Updates
    18. Updating Child Nodes and Attributes
    19. Updating Through the Parent
    20. Working with Values
    21. Setting Values
    22. Getting Values
    23. Values and Mixed Content Nodes
    24. Automatic XText Concatenation
    25. Documents and Declarations
    26. XDocument
    27. XML Declarations
    28. Names and Namespaces
    29. Namespaces in XML
    30. Specifying Namespaces in the X-DOM
    31. The X-DOM and Default Namespaces
    32. Prefixes
    33. Annotations
    34. Projecting into an X-DOM
    35. Eliminating Empty Elements
    36. Streaming a Projection
  12. 11. Other XML and JSON Technologies
    1. XmlReader
    2. Reading Nodes
    3. Reading Elements
    4. Reading Attributes
    5. Namespaces and Prefixes
    6. XmlWriter
    7. Writing Attributes
    8. Writing Other Node Types
    9. Namespaces and Prefixes
    10. Patterns for Using XmlReader/XmlWriter
    11. Working with Hierarchical Data
    12. Mixing XmlReader/XmlWriter with an X-DOM
    13. Working with JSON
    14. Utf8JsonReader
    15. Utf8JsonWriter
    16. JsonDocument
  13. 12. Disposal and Garbage Collection
    1. IDisposable, Dispose, and Close
    2. Standard Disposal Semantics
    3. When to Dispose
    4. Clearing Fields in Disposal
    5. Anonymous Disposal
    6. Automatic Garbage Collection
    7. Roots
    8. Finalizers
    9. Calling Dispose from a Finalizer
    10. Resurrection
    11. How the GC Works
    12. Optimization Techniques
    13. Forcing Garbage Collection
    14. Tuning Garbage Collection at Runtime
    15. Memory Pressure
    16. Array Pooling
    17. Managed Memory Leaks
    18. Timers
    19. Diagnosing Memory Leaks
    20. Weak References
    21. Weak References and Caching
    22. Weak References and Events
  14. 13. Diagnostics
    1. Conditional Compilation
    2. Conditional Compilation Versus Static Variable Flags
    3. The Conditional Attribute
    4. Debug and Trace Classes
    5. Fail and Assert
    6. TraceListener
    7. Flushing and Closing Listeners
    8. Debugger Integration
    9. Attaching and Breaking
    10. Debugger Attributes
    11. Processes and Process Threads
    12. Examining Running Processes
    13. Examining Threads in a Process
    14. StackTrace and StackFrame
    15. Windows Event Logs
    16. Writing to the Event Log
    17. Reading the Event Log
    18. Monitoring the Event Log
    19. Performance Counters
    20. Enumerating the Available Counters
    21. Reading Performance Counter Data
    22. Creating Counters and Writing Performance Data
    23. The Stopwatch Class
    24. Cross-Platform Diagnostics Tools
    25. dotnet-counters
    26. dotnet-trace
    27. dotnet-dump
  15. 14. Concurrency and Asynchrony
    1. Introduction
    2. Threading
    3. Creating a Thread
    4. Join and Sleep
    5. Blocking
    6. Local Versus Shared State
    7. Locking and Thread Safety
    8. Passing Data to a Thread
    9. Exception Handling
    10. Foreground Versus Background Threads
    11. Thread Priority
    12. Signaling
    13. Threading in Rich Client Applications
    14. Synchronization Contexts
    15. The Thread Pool
    16. Tasks
    17. Starting a Task
    18. Returning values
    19. Exceptions
    20. Continuations
    21. TaskCompletionSource
    22. Task.Delay
    23. Principles of Asynchrony
    24. Synchronous Versus Asynchronous Operations
    25. What Is Asynchronous Programming?
    26. Asynchronous Programming and Continuations
    27. Why Language Support Is Important
    28. Asynchronous Functions in C#
    29. Awaiting
    30. Writing Asynchronous Functions
    31. Asynchronous Lambda Expressions
    32. Asynchronous Streams
    33. Asynchronous Methods in WinRT
    34. Asynchrony and Synchronization Contexts
    35. Optimizations
    36. Asynchronous Patterns
    37. Cancellation
    38. Progress Reporting
    39. The Task-Based Asynchronous Pattern
    40. Task Combinators
    41. Asynchronous Locking
    42. Obsolete Patterns
    43. Asynchronous Programming Model
    44. Event-Based Asynchronous Pattern
    45. BackgroundWorker
  16. 15. Streams and I/O
    1. Stream Architecture
    2. Using Streams
    3. Reading and Writing
    4. Seeking
    5. Closing and Flushing
    6. Timeouts
    7. Thread Safety
    8. Backing Store Streams
    9. FileStream
    10. MemoryStream
    11. PipeStream
    12. BufferedStream
    13. Stream Adapters
    14. Text Adapters
    15. Binary Adapters
    16. Closing and Disposing Stream Adapters
    17. Compression Streams
    18. Compressing in Memory
    19. Unix gzip File Compression
    20. Working with ZIP Files
    21. File and Directory Operations
    22. The File Class
    23. The Directory Class
    24. FileInfo and DirectoryInfo
    25. Path
    26. Special Folders
    27. Querying Volume Information
    28. Catching Filesystem Events
    29. File I/O in UWP
    30. Working with Directories
    31. Working with Files
    32. Obtaining Directories and Files
    33. OS Security
    34. Running in a Standard User Account
    35. Administrative Elevation and Virtualization
    36. Memory-Mapped Files
    37. Memory-Mapped Files and Random File I/O
    38. Memory-Mapped Files and Shared Memory (Windows)
    39. Cross-Platform Interprocess Shared Memory
    40. Working with View Accessors
  17. 16. Networking
    1. Network Architecture
    2. Addresses and Ports
    3. URIs
    4. Client-Side Classes
    5. WebClient
    6. WebRequest and WebResponse
    7. HttpClient
    8. Proxies
    9. Authentication
    10. Exception Handling
    11. Working with HTTP
    12. Headers
    13. Query Strings
    14. Uploading Form Data
    15. Cookies
    16. Writing an HTTP Server
    17. Using FTP
    18. Using DNS
    19. Sending Mail with SmtpClient
    20. Using TCP
    21. Concurrency with TCP
    22. Receiving POP3 Mail with TCP
    23. TCP in UWP
  18. 17. Assemblies
    1. What’s in an Assembly
    2. The Assembly Manifest
    3. The Application Manifest (Windows)
    4. Modules
    5. The Assembly Class
    6. Strong Names and Assembly Signing
    7. How to Strongly Name an Assembly
    8. Assembly Names
    9. Fully Qualified Names
    10. The AssemblyName Class
    11. Assembly Informational and File Versions
    12. Authenticode Signing
    13. How to Sign with Authenticode
    14. Resources and Satellite Assemblies
    15. Directly Embedding Resources
    16. .resources Files
    17. .resx Files
    18. Satellite Assemblies
    19. Cultures and Subcultures
    20. Loading, Resolving, and Isolating Assemblies
    21. Assembly Load Contexts
    22. The Default ALC
    23. The “Current” ALC
    24. Assembly.Load and Contextual ALCs
    25. Loading and Resolving Unmanaged Libraries
    26. AssemblyDependencyResolver
    27. Unloading ALCs
    28. The Legacy Loading Methods
    29. Writing a Plug-In System
  19. 18. Reflection and Metadata
    1. Reflecting and Activating Types
    2. Obtaining a Type
    3. Type Names
    4. Base Types and Interfaces
    5. Instantiating Types
    6. Generic Types
    7. Reflecting and Invoking Members
    8. Member Types
    9. C# Members Versus CLR Members
    10. Generic Type Members
    11. Dynamically Invoking a Member
    12. Method Parameters
    13. Using Delegates for Performance
    14. Accessing Nonpublic Members
    15. Generic Methods
    16. Anonymously Calling Members of a Generic Interface
    17. Reflecting Assemblies
    18. Modules
    19. Working with Attributes
    20. Attribute Basics
    21. The AttributeUsage Attribute
    22. Defining Your Own Attribute
    23. Retrieving Attributes at Runtime
    24. Dynamic Code Generation
    25. Generating IL with DynamicMethod
    26. The Evaluation Stack
    27. Passing Arguments to a Dynamic Method
    28. Generating Local Variables
    29. Branching
    30. Instantiating Objects and Calling Instance Methods
    31. Exception Handling
    32. Emitting Assemblies and Types
    33. The Reflection.Emit Object Model
    34. Emitting Type Members
    35. Emitting Methods
    36. Emitting Fields and Properties
    37. Emitting Constructors
    38. Attaching Attributes
    39. Emitting Generic Methods and Types
    40. Defining Generic Methods
    41. Defining Generic Types
    42. Awkward Emission Targets
    43. Uncreated Closed Generics
    44. Circular Dependencies
    45. Parsing IL
    46. Writing a Disassembler
  20. 19. Dynamic Programming
    1. The Dynamic Language Runtime
    2. Numeric Type Unification
    3. Dynamic Member Overload Resolution
    4. Simplifying the Visitor Pattern
    5. Anonymously Calling Members of a Generic Type
    6. Implementing Dynamic Objects
    7. DynamicObject
    8. ExpandoObject
    9. Interoperating with Dynamic Languages
    10. Passing State Between C# and a Script
  21. 20. Cryptography
    1. Overview
    2. Windows Data Protection
    3. Hashing
    4. Hash Algorithms in .NET
    5. Hashing Passwords
    6. Symmetric Encryption
    7. Encrypting in Memory
    8. Chaining Encryption Streams
    9. Disposing Encryption Objects
    10. Key Management
    11. Public-Key Encryption and Signing
    12. The RSA Class
    13. Digital Signing
  22. 21. Advanced Threading
    1. Synchronization Overview
    2. Exclusive Locking
    3. The lock Statement
    4. Monitor.Enter and Monitor.Exit
    5. Choosing the Synchronization Object
    6. When to Lock
    7. Locking and Atomicity
    8. Nested Locking
    9. Deadlocks
    10. Performance
    11. Mutex
    12. Locking and Thread Safety
    13. Thread Safety and .NET Types
    14. Thread Safety in Application Servers
    15. Immutable Objects
    16. Nonexclusive Locking
    17. Semaphore
    18. Reader/Writer Locks
    19. Signaling with Event Wait Handles
    20. AutoResetEvent
    21. ManualResetEvent
    22. CountdownEvent
    23. Creating a Cross-Process EventWaitHandle
    24. Wait Handles and Continuations
    25. WaitAny, WaitAll, and SignalAndWait
    26. The Barrier Class
    27. Lazy Initialization
    28. Lazy<T>
    29. LazyInitializer
    30. Thread-Local Storage
    31. [ThreadStatic]
    32. ThreadLocal<T>
    33. GetData and SetData
    34. AsyncLocal<T>
    35. Timers
    36. Multithreaded Timers
    37. Single-Threaded Timers
  23. 22. Parallel Programming
    1. Why PFX?
    2. PFX Concepts
    3. PFX Components
    4. When to Use PFX
    5. PLINQ
    6. Parallel Execution Ballistics
    7. PLINQ and Ordering
    8. PLINQ Limitations
    9. Example: Parallel Spellchecker
    10. Functional Purity
    11. Setting the Degree of Parallelism
    12. Cancellation
    13. Optimizing PLINQ
    14. The Parallel Class
    15. Parallel.Invoke
    16. Parallel.For and Parallel.ForEach
    17. Task Parallelism
    18. Creating and Starting Tasks
    19. Waiting on Multiple Tasks
    20. Canceling Tasks
    21. Continuations
    22. Task Schedulers
    23. TaskFactory
    24. Working with AggregateException
    25. Flatten and Handle
    26. Concurrent Collections
    27. IProducerConsumerCollection<T>
    28. ConcurrentBag<T>
    29. BlockingCollection<T>
    30. Writing a Producer/Consumer Queue
  24. 23. Span<T> and Memory<T>
    1. Spans and Slicing
    2. CopyTo and TryCopyTo
    3. Working with Text
    4. Memory<T>
    5. Forward-Only Enumerators
    6. Working with Stack-Allocated and Unmanaged Memory
  25. 24. Native and COM Interoperability
    1. Calling into Native DLLs
    2. Type and Parameter Marshaling
    3. Marshaling Common Types
    4. Marshaling Classes and Structs
    5. In and Out Marshaling
    6. Calling Conventions
    7. Callbacks from Unmanaged Code
    8. Callbacks with Function Pointers (C# 9)
    9. Callbacks with Delegates
    10. Simulating a C Union
    11. Shared Memory
    12. Mapping a Struct to Unmanaged Memory
    13. fixed and fixed {...}
    14. COM Interoperability
    15. The Purpose of COM
    16. The Basics of the COM Type System
    17. Calling a COM Component from C#
    18. Optional Parameters and Named Arguments
    19. Implicit ref Parameters
    20. Indexers
    21. Dynamic Binding
    22. Embedding Interop Types
    23. Type Equivalence
    24. Exposing C# Objects to COM
    25. Enabling Registry-Free COM
  26. 25. Regular Expressions
    1. Regular Expression Basics
    2. Compiled Regular Expressions
    3. RegexOptions
    4. Character Escapes
    5. Character Sets
    6. Quantifiers
    7. Greedy Versus Lazy Quantifiers
    8. Zero-Width Assertions
    9. Lookahead and Lookbehind
    10. Anchors
    11. Word Boundaries
    12. Groups
    13. Named Groups
    14. Replacing and Splitting Text
    15. MatchEvaluator Delegate
    16. Splitting Text
    17. Cookbook Regular Expressions
    18. Recipes
    19. Regular Expressions Language Reference
  27. Index
18.224.0.25