68k words 1:02

# Chapter 24 Runtime Serialization # Serialization/Deserialization Quick Start Let’s start off by looking at some code. using System;using System.Collections.Generic;using System.IO;using System.Runtime.Serialization.Formatters.Binary;internal static class QuickStart { public static void...
62k words 56 mins.

# Chapter 23 Assembly Loading and Reflection # Assembly Loading As you know, when the just-in-time (JIT) compiler compiles the Intermediate Language (IL) for a method, it sees what types are referenced in the IL code. Then at run time, the JIT compiler uses the assembly’s TypeRef and AssemblyRef...
69k words 1:03

# Chapter 22 CLR Hosting and AppDomains # CLR Hosting The .NET Framework runs on top of Windows. This means that the .NET Framework must be built using technologies that Windows can interface with. For starters, all managed module and assembly files must use the Windows portable executable (PE)...
107k words 1:38

# Chapter 20 Exceptions and State Management # Defining “Exception” When designing a type, you first imagine the various situations in which the type will be used. The type name is usually a noun, such as FileStream or StringBuilder. Then you define the properties, methods, events, and so on for...
13k words 12 mins.

# Chapter 19 Nullable Value Types As you know, a variable of a value type can never be null; it always contains the value type’s value itself. In fact, this is why they call these types value types. Unfortunately, there are some scenarios in which this is a problem. For example, when designing a...
40k words 37 mins.

# Chapter 18 Custom Attributes # Using Custom Attributes Attributes, such as public, private, static, and so on, can be applied to types and members. I think we’d all agree on the usefulness of applying attributes, but wouldn’t it be even more useful if we could define our own attributes? For...
52k words 47 mins.

# Chapter 17 Delegates # A First Look at Delegates The C runtime’s qsort function takes a pointer to a callback function to sort elements within an array. In Windows, callback functions are required for window procedures, hook procedures, asynchronous procedure calls, and more. In the .NET...
38k words 34 mins.

# Chapter 16 Arrays Arrays are mechanisms that allow you to treat several items as a single collection. The Microsoft .NET common language runtime (CLR) supports single-dimensional arrays, multi-dimensional arrays, and jagged arrays (that is, arrays of arrays). All array types are implicitly...
23k words 21 mins.

# Chapter 15 Enumerated Types and Bit Flags # Enumerated Types An enumerated type is a type that defines a set of symbolic name and value pairs. For example, the Color type shown here defines a set of symbols, with each symbol identifying a single color. internal enum Color { White, //...