Contents of This Book

Part I, Part II, and Part III of this book document the C# language, the .NET CLR, and relevant tools that ship with the .NET Framework downloadable SDK. Part I, Programming with C#, introduces the C# language and the .NET Framework:

Chapter 1

Chapter 1 provides an overview of the C# language and the .NET Framework, with special attention to their key features and benefits.

Chapter 2

This chapter introduces the elements of the C# language, including data types and basic constructs such as expressions and statements. Special notation is used throughout the chapter to summarize C# syntax rules for later reference.

Chapter 3

Chapter 3 explains how to define and instantiate new types in C#. In C#, all classes are components that embody both executable code and metadata used by the CLR at runtime.

Chapter 4

This chapter explains features of the C# language used to handle events and exceptions, callbacks, custom attributes and more.

Part II contains:

Chapter 5

Chapter 5 is an overview of the core .NET Framework APIs covered in this book. The APIs themselves are covered in Part IV. Here you will find a summary of the support you can expect in each functional area of the FCL, along with lists of the namespaces in which the relevant types are found.

Chapter 6,

This chapter describes key FCL types available for string manipulation and shows how to program them using C#. The FCL offers a wide range of advanced string handling features. FCL types for regular expression matching and replacement capabilities based on Perl5 regular expressions are also covered.

Chapter 7

Chapter 7 presents the most important FCL types for working with common data structures such as arrays, hashtables, dictionaries, stacks, and more. Also covered are key collection interfaces such as IEnumerable, ICollection, and IComparable.

Chapter 8

This chapter introduces built-in FCL support for XML, explains the relationships between XML and the I/O system in general, demonstrates the consumption and production of XML documents in both node-based and Infoset-based forms, highlights the use of XPath, and explores XSLT.

Chapter 9

The FCL includes a number of types that make accessing networked resources easy. Chapter 9 describes the core networking support in the FCL and provides numerous examples leveraging the predefined classes.

Chapter 10

This chapter introduces built-in FCL support for handling streams and I/O, explains relationships between the abstract and concrete classes in the streams architecture, demonstrates their usage, and explores the filesystem-specific support.

Chapter 11

Chapter 11 introduces the built-in support for object serialization and deserialization, and demonstrates how clients and objects can participate in the serialization and deserialization process.

Chapter 12

This chapter explains the configuration and use of assemblies, the fundamental unit of deployment in .NET. The FCL provides attributes and types for managing assemblies, which are also covered.

Chapter 13

Chapter 13 describes the key FCL types available for examining the metadata of existing types using reflection. Creating new types (and associated metadata) is termed Reflection.Emit, and is done via the types in the System.Reflection.Emit namespace, which is also explored in this chapter.

Chapter 14

Types, members, modules, and assemblies all have associated metadata that is used by all the major CLR services, which is considered an indivisible part of an application, and can be accessed via reflection, as explained in Chapter 13. This chapter explains how to add custom metadata to application elements by writing custom attributes.

Chapter 15

The .NET Framework provides automatic garbage collection of types no longer in use, and allows programmers to provide their own finalizers via C# destructors. This chapter also shows how to provide Dispose( ) or Close( ) methods to clean up after an object whose work is finished.

Chapter 16

Chapter 16 explains the use of FCL types to manage application threads. C# provides a lock statement to synchronize access to shared resources, and the FCL includes a Monitor class to implement pulse and wait, atomic, and other thread operations.

Chapter 17

This chapter explains the PInvoke services through which C# programs can interact with legacy DLLs.

Chapter 18

Chapter 18 discusses FCL types and attributes used to expose COM objects to C# programs and to expose C# objects to COM.

Chapter 19

Because providing integrated error handling and reporting is such a common need among applications, the .NET Framework provides a diverse set of facilities to monitor application behavior, detect runtime errors, inspect the application environment, report application status, and integrate with debugging tools if available. This chapter introduces the debugging and diagnostics support provided by the FCL.

Chapter 20

Chapter 20 contains a concise alphabetical listing of all C# language constructs and their syntax.

Part III contains:

Chapter 21

C# provides XML documentation tags that facilitate the development of application documentation within the source code itself. This chapter presents the tags available to programmers and illustrates their use.

Chapter 22

Chapter 22 proposes guidelines for naming and casing elements of C# programs. The guidelines are drawn from official Microsoft documents and the experiences of the authors.

Chapter 23

This chapter is a reference to useful command-line tools that ship with Visual Studio .NET and the .NET Framework, including the compiler and debugger.

The 23 chapters in Parts I-III of C# in a Nutshell teach you the C# language and get you up and running with many of the most important APIs of the .NET Framework. The other half of the book is Part IV, which is a succinct but detailed API reference of 21 important namespaces and more than 700 core types and their members. Please be sure to read Chapter 24, How to Use This Quick Reference, which appears at the beginning of Part IV and explains how to get the most from its content.

Part V includes additional reference tables for regular expression syntax (Appendix A); format specifiers (Appendix B); C#-to-COM default data mapping (Appendix C); a glossary of C# keywords (Appendix D); an alphabetical list of .NET namespaces and the DLLs that expose them (Appendix E); and a Appendix F in which you can look up a method or field and find what type it is defined in.

Get C# in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.