Code Listings

The following code listings are all copy-and-paste friendly.

Code Listings for C# 9 in a Nutshell

If you're running Windows, browsing the samples online is not the best way to go! Almost all of the code listings are available as interactive samples in LINQPad 7 (or LINQPad 6). From LINQPad's samples TreeView (bottom left), click Download more samples and choose C# 9 in a Nutshell. All 1250 samples will then be searchable and executable from within LINQPad.

Chapter 2: C# Language Basics

Chapter 3: Creating Types in C#

Chapter 4: Advanced C#

Chapter 6: Framework Fundamentals

Chapter 7: Collections

Chapter 8: LINQ Queries

Chapter 9: LINQ Operators

Chapter 10: LINQ to XML

Chapter 11: Other XML and JSON Technologies

Chapter 12: Disposal and Garbage Collection

Chapter 13: Diagnostics

Chapter 14: Concurrency and Asynchrony

Chapter 15: Streams and IO

Chapter 16: Networking

Chapter 17: Assemblies

Chapter 18: Reflection and Metadata

Chapter 19: Dynamic Programming

Chapter 20: Cryptography

Chapter 21: Advanced Threading

Chapter 22: Parallel Programming

Chapter 23: Span and Memory

Chapter 24: Native and COM Interoperability

Chapter 25: Regular Expressions

Code Listings for C# 8 in a Nutshell

If you're running Windows, browsing the samples online is not the best way to go! Almost all of the code listings are available as interactive samples in LINQPad 6. From LINQPad's samples TreeView (bottom left), click Download more samples and choose C# 8 in a Nutshell. All 1250 samples will then be searchable and executable from within LINQPad.

Chapter 2: C# Language Basics

Chapter 3: Creating Types in C#

Chapter 4: Advanced C#

Chapter 6: Framework Fundamentals

Chapter 7: Collections

Chapter 8: LINQ Queries

Chapter 9: LINQ Operators

Chapter 10: LINQ to XML

Chapter 11: Other XML and JSON Technologies

Chapter 12: Disposal and Garbage Collection

Chapter 13: Diagnostics

Chapter 14: Concurrency and Asynchrony

Chapter 15: Streams and IO

Chapter 16: Networking

Chapter 17: Serialization

Chapter 18: Assemblies

Chapter 19: Reflection and Metadata

Chapter 20: Dynamic Programming

Chapter 21: Cryptography

Chapter 22: Advanced Threading

Chapter 23: Parallel Programming

Chapter 24: Span and Memory

Chapter 25: Native and COM Interoperability

Chapter 26: Regular Expressions

Chapter 27: The Roslyn Compiler

Code Listings for C# 7 in a Nutshell and C# 6 in a Nutshell

Code listings for Chapters 2-10, 14, 20, 22, 23 and 26 are available as interactive samples in LINQPad 5.
Go to LINQPad's samples tree view (bottom left) and click Download more samples to get all of the above chapters.

Chapter 11: Other XML Technologies

Chapter 12: Disposal and Garbage Collection

Chapter 13: Code Contracts and Diagnostics

Chapter 15: Streams and I/O

Chapter 16: Networking

Chapter 17: Serialization

Chapter 18: Assemblies

Chapter 19: Reflection and Metadata

Chapter 20: Dynamic Programming

Chapter 21: Security

Chapter 24: Application Domains

Chapter 25: Native Interop

C# 9.0 in a Nutshell
Buy from amazon.com Buy print or Kindle edition
Buy from ebooks.com Buy PDF edition
Buy from O'Reilly Read via Safari subscription