Course
Skills Expanded
C# Language Internals - Part 1
C# Language Internals is designed to give you a deeper understanding of the C# programming language and the CLR.
What you'll learn
This course takes .NET developers behind the scenes of C# language features to gain a deeper understanding of the language, the Intermediate Language (IL) it compiles into, and the Common Language Runtime (CLR) it runs on. By studying language internals, you can make well-informed design choices, solve hard debugging puzzles quicker, and understand the performance ramifications of using various language features. This is the first part of a two-part course.
Table of contents
Essential Techniques
27mins
The CLR and IL in a Nutshell
41mins
- Introduction to Intermediate Language (IL) 3m
- Essential IL Instructions 2m
- Local Variables in IL 5m
- Basic IL Instructions and Branches 4m
- Analyzing Branches in ILDASM 3m
- Call Instructions and Call Stacks 5m
- Exceptions, Objects, and Arrays 4m
- The Role of JIT Compilation 7m
- Seeing JIT Compilation in Action in WinDbg 5m
- JIT Optimizations 2m
- Summary 1m
C# Compiler Tidbits
40mins
- Overview of C# Compiler Settings 2m
- Optimization Techniques used by the C# Compiler 4m
- Branch Optimizations 3m
- Inspecting Branching for Loops in ILDASM 4m
- Specifying Compilation Targets 3m
- Inside Windows Runtime Modules 2m
- Constraining Target Platform Architectures 5m
- Language Versions 2m
- Assembly References 5m
- Introducing Portable Library 4m
- Type Forwarders in ILDASM 4m
- Summary 1m
Performance of Imperative C# Code
40mins
- Compile-Time Constants and Array Initializers 4m
- Inspecting Array Initializers in ILDASM 3m
- The Essentials of Switch Statements 3m
- Optimizations of Switch Statements 5m
- Analyzing Switch Statements in ILDASM 3m
- Switch Statements with Strings 3m
- Behind the Scenes of Switch Statements for Strings in ILDASM 4m
- Final Remarks about Switch Statements 1m
- The Essentials of Events 3m
- Compiler-Generated Add and Remove Accessors 4m
- Building a Custom Event Manager 4m
- Windows Runtime Event Support in C# 5.0 2m
- Summary 1m
Performance of Functional C# Code
40mins
- Anonymous Methods under the Hood 3m
- Intermezzo on Compiler-Generated Names 2m
- Lambda Expressions and Homoiconicity 2m
- Inspecting Anonymous Methods in ILDASM 3m
- Introduction to Closures 6m
- Display Classes Behind the Scenes 5m
- Closures and Space Leaks 3m
- Debugging a Space Leak using WinDbg and SOS 6m
- Scoping of Foreach Loop Variables in Closures 4m
- Analyzing Foreach Loop Variable Scoping in ILDASM 5m
- Summary 2m
Leveraging C# Extensibility Points, Part 1
40mins
- Syntactic Sugar in C# 2m
- Foreach Statement and the Enumeration Pattern 3m
- Typing in Foreach Statements 4m
- Operator Overloading in a Nutshell 3m
- Domain Specific Languages (DSLs) using Operator Overloading 3m
- Building a Small Internal DSL 4m
- Lifted Nullable Operators 2m
- Query Expressions and the Query Pattern 3m
- LINQ to Anything Implementation Techniques 2m
- Building a Simple Query Provider 3m
- How Traditional Query Providers Work 4m
- Transparent Identifiers 3m
- Spotting Transparent Identifiers in ILDASM 2m
- Summary 1m
Leveraging C# Extensibility Points, Part 2
38mins
- Overview of C# Dynamic and the DLR 4m
- The Dynamic Type in C# 2m
- Analyzing Dynamic Typing using ILSpy 6m
- Under the Hood of Dynamic using SOS 5m
- Extending Dynamic with DynamicObject 3m
- Implementing a Simple Expando Object 5m
- Awaitable Types and the Awaiter Pattern 3m
- Compilation of Async Methods 5m
- Implementing a Button Awaiter 5m
- Summary 1m
Generics Behind the Scenes
40mins
- Introduction to Generic Typing 3m
- Why Generics Matter 2m
- Performance Benefits of Generics 5m
- Generics Under the Hood 3m
- Studying Generic Types using WinDbg and SOS 5m
- Constrained Virtual Calls 2m
- Overview of Generic Constraints 3m
- Co- and Contravariance in Pictures 4m
- Broken Array Covariance 5m
- Generic Variance Modifiers 3m
- Behind the Scenes of Generic Variance 4m
- Summary 2m