This post was translated from the original with AI assistance. Read the original
Key chapters of CLR via C#.
The checked items are the important ones. The unchecked ones should be read through; don’t just skip them. Items with page numbers or highlighting are must-reads.
Chapter 1 The CLR’s Execution Model#
- 1.1 Compiling Source Code into Managed Modules
- The parts of a managed module (p5)
- Overview of metadata (p5)
- 1.2 Combining Managed Modules into Assemblies
- The concept of an assembly (p6-7)
- 1.3 Loading the Common Language Runtime
- 1.4 Executing Your Assembly’s Code
- What the JITCompiler function does (p11)
- Overview of IL (p15)
- 1.5 The Native Code Generator Tool: NGen.exe
- 1.6 The Framework Class Library
- General FCL namespaces (p21)
- 1.7 The Common Type System
- Access modifiers (p23)
- 1.8 The Common Language Specification
- The relationship between C#, the CLR/CTS and the CLS (p25)
- The Test class and its IL (p26-27)
- 1.9 Interoperability with Unmanaged Code
Chapter 2 Building, Packaging, Deploying, and Administering Applications and Types#
- 2.1 .NET Framework Deployment Goals
- 2.2 Building Types into a Module (hands-on practice recommended)
- 2.3 A Brief Look at Metadata
- The concept of metadata (p33)
- The metadata tables (p34-35)
- Viewing metadata with IL tools (p35-38, hands-on practice recommended)
- 2.4 Combining Modules to Form an Assembly
- Assemblies and manifests (p39)
- Manifest metadata tables (p41)
- /addmodule and the structure of a multi-module assembly (p42-43, hands-on practice recommended)
- AL.exe (p45-47, hands-on practice recommended)
- 2.5 Assembly Version Resource Information
- Version number format (p50)
- 2.6 Culture
- The concept of satellite assemblies (p51)
- 2.7 Simple Application Deployment (Privately Deployed Assemblies)
- 2.8 Simple Administrative Control (Configuration)
Chapter 3 Shared Assemblies and Strongly Named Assemblies#
- 3.1 Two Kinds of Assemblies, Two Kinds of Deployment
- The difference between weakly named and strongly named assemblies (p58)
- 3.2 Giving an Assembly a Strong Name
- The structure of a strongly named assembly’s string identity (p59)
- The concept and process of signing (p59-63)
- 3.3 The Global Assembly Cache
- 3.4 Building an Assembly That References a Strongly Named Assembly
- 3.5 Strongly Named Assemblies Are Tamper-Resistant
- 3.6 Delayed Signing
- 3.7 Privately Deploying Strongly Named Assemblies
- 3.8 How the Runtime Resolves Type References (understand the process, using the diagram on p72)
- 3.9 Advanced Administrative Control (Configuration)
Chapter 4 Type Fundamentals#
- 4.1 All Types Are Derived from System.Object
- The methods of System.Object (p81-82)
- What the new operator does (p82-83)
- 4.2 Casting Between Types
- The concepts of is and as and how they differ
- Type-safety quiz (code on p85, table on p86, hands-on practice recommended)
- 4.3 Namespaces and Assemblies
- The relationship between namespaces and assemblies (p89)
- 4.4 How Things Relate at Run Time (all of it is gold)
Chapter 5 Primitive, Reference, and Value Types#
- 5.1 Programming Language Primitive Types
- C# primitive types and their corresponding FCL types (table on p100)
- checked and unchecked (p102-105, hands-on practice recommended, look at the IL)
- 5.2 Reference Types and Value Types
- The concepts of and differences between reference types and value types (p106-109)
- How the CLR controls the layout of a type’s fields (p110)
- 5.3 Boxing and Unboxing Value Types
- The concept of boxing (p111)
- The concept of unboxing (p112)
- Some examples (p113-123, hands-on practice recommended, look at the IL)
- Equals and identity (p123-126)
- 5.4 Object Hash Codes
- 5.5 The dynamic Primitive Type
- The concept and features of dynamic
- The difference between dynamic and var (p130)
- dynamic and reflection
Chapter 6 Type and Member Basics#
- 6.1 The Different Kinds of Type Members
- 6.2 Type Visibility
- 6.3 Member Accessibility
- 6.4 Static Classes
- 6.5 Partial Classes, Structures, and Interfaces
- 6.6 Components, Polymorphism, and Versioning
- How C# keywords affect versioning (table on p144)
- How the CLR calls virtual methods, properties, and events
- The difference between call and callvirt (p145-147)
Chapter 7 Constants and Fields#
- 7.1 Constants
- 7.2 Fields
Chapter 8 Methods#
- 8.1 Instance Constructors and Classes (Reference Types)
- 8.2 Instance Constructors and Structures (Value Types)
- 8.3 Type Constructors
- When does a value type’s type constructor get called? (think about it; hands-on practice strongly recommended)
- 8.4 Operator Overload Methods
- 8.5 Conversion Operator Methods
- 8.6 Extension Methods (hands-on practice recommended)
- 8.7 Partial Methods (hands-on practice recommended)
Chapter 9 Parameters#
- 9.1 Optional and Named Parameters (hands-on practice recommended)
- 9.2 Implicitly Typed Local Variables (hands-on practice recommended)
- 9.3 Passing Parameters by Reference to a Method
- The differences and similarities between out and ref (p190-195, hands-on practice strongly recommended, look at the IL)
- 9.4 Passing a Variable Number of Arguments to a Method
- The Concat method and params (p197)
- 9.5 Parameter and Return Type Guidelines
- 9.6 Const-ness
- What does immutable mean? (think about it)
Chapter 10 Properties#
- 10.1 Parameterless Properties
- What properties really are (p203-p205)
- Object and collection initializers (p208)
- Anonymous types (p209)
- The Tuple type
- 10.2 Parameterful Properties
- The concept of parameterful properties (p214-217)
- The IndexerName attribute (p217-218)
- 10.3 The Performance of Calling Property Accessor Methods
- 10.4 Property Accessor Accessibility
- 10.5 Generic Property Accessor Methods
Chapter 11 Events#
- 11.1 Designing a Type That Exposes an Event
- The steps to define an event (p222-226, hands-on practice recommended)
- How to raise an event in a thread-safe way (p225)
- 11.2 How the Compiler Implements an Event
- What events really are, how events relate to delegates, and how events achieve thread safety (p227-228)
- 11.3 Designing a Type That Listens for an Event (hands-on practice recommended)
- 11.4 Explicitly Implementing an Event (hands-on practice recommended)
Chapter 12 Generics#
- 12.1 Generics in the Framework Class Library
- 12.2 Generics Infrastructure
- Open and closed types (p239-240, hands-on practice recommended)
- Generic types and inheritance (p240, hands-on practice recommended)
- Generic type identity (p242)
- Code explosion (p243)
- 12.3 Generic Interfaces
- 12.4 Generic Delegates
- 12.5 Delegate and Interface Contra-variant and Covariant Generic Type Arguments
- 12.6 Generic Methods
- 12.7 Generics and Other Members
- 12.8 Verifiability and Constraints
- Primary constraints (p252)
- Secondary constraints (p253)
- Constructor constraints (p254)
- Other verifiability issues (p254-257)
Chapter 13 Interfaces#
- 13.1 Class and Interface Inheritance
- 13.2 Defining an Interface
- 13.3 Inheriting an Interface
- 13.4 More About Calling Interface Methods
- 13.5 Implicit and Explicit Interface Method Implementations (What’s Happening Behind the Scenes)
- 13.6 Generic Interfaces
- 13.7 Generics and Interface Constraints
- 13.8 Implementing Multiple Interfaces That Have the Same Method Name and Signature
- 13.9 Improving Compile-Time Type Safety with Explicit Interface Method Implementations
- 13.10 Be Careful with Explicit Interface Method Implementations
- 13.11 Design: Base Class or Interface?
Chapter 14 Chars, Strings, and Working with Text#
- 14.1 Characters
- 14.2 The System.String Type
- Strings are immutable (p284)
- Comparing strings
- Language and culture
- String interning (p290-292)
- String pooling (p293)
- Examining a string’s characters and text elements
- Other string operations
- 14.3 Constructing a String Efficiently
- Constructing a StringBuilder object (p296)
- StringBuilder members (p297-298)
- 14.4 Obtaining a String Representation of an Object: ToString
- 14.5 Parsing a String to Obtain an Object: Parse
- 14.6 Encodings: Converting Between Characters and Bytes
- The differences between encodings such as UTF-8, UTF-16 and UTF-32 (p309)
- Encoding and decoding (p309-315)
- 14.7 Secure Strings
Chapter 15 Enumerated Types and Bit Flags#
- 15.1 Enumerated Types
- What enumerated types really are (p320)
- How to change an enumerated type’s underlying type (p321)
- Is an enumerated type a reference type or a value type? Is System.Enum a reference type or a value type? (think about it)
- 15.2 Bit Flags
- 15.3 Adding Methods to Enumerated Types
Chapter 16 Arrays#
- 16.0 Overview of arrays (it has no heading, but it’s very important)
- Arrays are reference types (p329)
- The memory layout of arrays (p330)
- Concepts of single-dimensional, multi-dimensional, zero-based and non-zero-based arrays (p330-331)
- 16.1 Initializing Array Elements
- 16.2 Casting Arrays
- What the Array.Copy method does (p334)
- 16.3 All Arrays Are Implicitly Derived from System.Array
- 16.4 All Arrays Implicitly Implement IEnumerable, ICollection, and IList
- 16.5 Passing and Returning Arrays
- 16.6 Creating Non-Zero Lower Bound Arrays
- 16.7 Array Internals
- 16.8 Unsafe Array Access and Fixed-Size Arrays
Chapter 17 Delegates#
- 17.1 A First Look at Delegates
- 17.2 Using Delegates to Call Back Static Methods
- 17.3 Using Delegates to Call Back Instance Methods
- 17.4 Demystifying Delegates
- 17.5 Using Delegates to Call Back Many Methods (Chaining)
- Are delegates immutable? (think about it)
- 17.6 Enough with the Delegate Definitions Already (Generic Delegates)
- 17.7 C#’s Syntactical Sugar for Delegates
- Syntactical shortcut #1: no need to construct a delegate object (p360)
- Syntactical shortcut #2: no need to define a callback method (lambda expressions) (p361)
- Syntactical shortcut #3: no need to manually wrap local variables in a class to pass them to a callback method (p364)
- 17.8 Delegates and Reflection
Chapter 18 Custom Attributes#
- 18.1 Using Custom Attributes
- 18.2 Defining Your Own Attribute Class
- 18.3 Attribute Constructor and Field/Property Data Types
- 18.4 Detecting the Use of a Custom Attribute
- IsDefined, GetCustomAttribute, GetCustomAttributes (p379-382)
- 18.5 Matching Two Attribute Instances Against Each Other
- 18.6 Detecting the Use of a Custom Attribute Without Creating Attribute-Derived Objects
- 18.7 Conditional Attribute Classes
Chapter 19 Nullable Value Types#
- 19.0 System.Nullable<T>
- 19.1 C#’s Support for Nullable Value Types
- 19.2 C#’s Null-Coalescing Operator
- 19.3 The CLR Has Special Support for Nullable Value Types
- Boxing nullable value types (p394)
- Unboxing nullable value types (p395)
- Calling GetType via a nullable value type
- Calling interface methods via a nullable value type
Chapter 20 Exceptions and State Management#
- 20.1 Defining “Exception”
- 20.2 Exception-Handling Mechanics
- The try block (p402)
- The catch block (p402-403)
- The finally block (p404-406)
- 20.3 The System.Exception Class
- Public properties of System.Exception (p407)
- 20.4 FCL-Defined Exception Classes
- 20.5 Throwing an Exception
- 20.6 Defining Your Own Exception Class
- 20.7 Trading Reliability for Productivity
- 20.8 Guidelines and Best Practices
- 20.9 Unhandled Exceptions
- 20.10 Debugging Exceptions
- 20.11 Exception-Handling Performance Considerations
- 20.12 Constrained Execution Regions (CERs)
- 20.13 Code Contracts
Chapter 21 The Managed Heap and Garbage Collection (all of it is gold)#
- 21.1 Managed Heap Basics
- 21.2 Generations: Improving Performance
- Generations 0, 1 and 2 (p454-457)
- Garbage collection triggers (p458-459)
- Large objects (p459)
- Garbage collection modes (p459-462)
- Forcing garbage collections (p462-463)
- Monitoring your application’s memory usage
- 21.3 Working with Types Requiring Special Cleanup
- SafeHandle, CriticalFinalizerObject (p467)
- IDisposable, Dispose (p471)
- Other GC features for use with native resources (p475-479, hands-on practice strongly recommended)
- Finalization internals (p479-481)
- Monitoring and controlling the lifetime of objects manually (p481-487)
Chapter 22 CLR Hosting and AppDomains#
- 22.1 CLR Hosting
- 22.2 AppDomains
- Diagram of AppDomain hosting structure (p493)
- Accessing objects across AppDomain boundaries (p494-504)
- 22.3 AppDomain Unloading
- 22.4 AppDomain Monitoring
- 22.5 AppDomain First-Chance Exception Notifications
- 22.6 How Hosts Use AppDomains
- 22.7 Advanced Host Control
Chapter 23 Assembly Loading and Reflection#
- 23.1 Assembly Loading
- Load, LoadFrom and other methods(p516-519)
- 23.2 Using Reflection to Build a Dynamically Extensible Application
- 23.3 Reflection Performance
- 23.4 Designing an Application That Supports Add-Ins
- 23.5 Using Reflection to Discover a Type’s Members
Comments