There are language constructs you’ll use every day in almost every C# program you write.
Chapter 1, “C# Language Idioms,” covers those language idioms you’ll use so often they
should feel like well-worn tools in your hands. These are the building blocks of every type
you create and every algorithm you implement.
Working in a managed environment doesn’t mean the environment absolves you of all your
responsibilities. You still must work with the environment to create correct programs that
satisfy the stated performance requirements. It’s not just about performance testing and
performance tuning. Chapter 2, “.NET Resource Management,” teaches you the design idioms
that enable you to work with the environment to achieve those goals before detailed
optimization begins.
Generics are the enabling technology for everything else added to the C# language since C#
2.0. Chapter 3, “Working with Generics,” covers generics as a replacement for
System.Object and casts and then moves on to discuss advanced techniques such as
constraints, generic specialization, method constraints, and backward compatibility. You’ll
learn several techniques in which generics will make it easier to express your design intent.
Chapter 4, “Working with LINQ,” explains LINQ, query syntax, and related features. You’ll
see when to use extension methods to separate contracts from implementation, how to use C#
closures effectively, and how to program with anonymous types. You’ll learn how the
compiler maps query keywords to method calls, how to distinguish between delegates and
expression trees (and convert between them when needed), and how to escape queries when
you’re looking for scalar results.
Chapter 5, “Exception Practices,” provides guidance on managing exceptions and errors in
modern C# programs. You’ll learn how to ensure that errors are reported properly and how
to leave program state consistent and ideally unchanged when errors occur. You’ll learn how
to provide a better debugging experience for developers who use your code.