You are previewing Introducing Visual C# 2010.
O'Reilly logo
Introducing Visual C# 2010

Book Description

If you're new to C# programming, this book is the ideal way to get started. Respected author Adam Freeman guides you through the C# language by carefully building up your knowledge from fundamental concepts to advanced features.

The book gradually builds up your knowledge, using the concepts you have already grasped to support those that come next. You will explore all the core areas of the C# language and the .NET Framework on which it runs. Particular attention is paid to the creation of Web and Windows applications and data access—danger zones where novice programmers often go awry in their early coding attempts.

Introducing Visual C# 2010 is a comprehensive primer. Even if you have no previous programming experience, you can have confidence in the fact that you'll be able to build well constructed web and Windows applications of your own once you have finished reading this book.

Table of Contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. I. Getting Started
    1. 1. Introduction
      1. 1.1. Who Should Read This Book?
      2. 1.2. What Is Covered in This Book?
      3. 1.3. What Do You Need to Read This Book?
      4. 1.4. What Is the Structure of This Book?
      5. 1.5. What Is in Each Chapter?
      6. 1.6. Getting the Example Code
      7. 1.7. Finding More Information
        1. 1.7.1. The MSDN C# Programming Guide
        2. 1.7.2. Online Forums
        3. 1.7.3. Other Books
      8. 1.8. Summary
    2. 2. Getting Ready
      1. 2.1. Installing the Software
        1. 2.1.1. Installing Visual Studio 2010
        2. 2.1.2. Installing SQL Server 2008
        3. 2.1.3. Installing the Silverlight Tools
        4. 2.1.4. Downloading the Sample Code and Data
      2. 2.2. Creating Your First C# Project
        1. 2.2.1. Creating the Project
        2. 2.2.2. Editing the Code
        3. 2.2.3. Compiling and Running the Program
      3. 2.3. Features That I Use Before Explaining Them
        1. 2.3.1. The using statements
        2. 2.3.2. The namespace statement
        3. 2.3.3. The class statement
        4. 2.3.4. The Main method
        5. 2.3.5. The Code Comments
        6. 2.3.6. The Console.WriteLine and Console.ReadLine methods
      4. 2.4. Summary
    3. 3. Understanding C# and the .NET Framework
      1. 3.1. C# and the .NET Framework at a Glance
        1. 3.1.1. Introducing C#
        2. 3.1.2. Introducing the .NET Framework
          1. 3.1.2.1. Introducing the Common Language Runtime
          2. 3.1.2.2. Introducing the Class Library
        3. 3.1.3. The Relationship between C# and the .NET Framework
          1. 3.1.3.1. Using C# Code Files
        4. 3.1.4. Understanding Assemblies
      2. 3.2. The Key Features of C# and the .NET Framework
        1. 3.2.1. Understanding Object-Orientation
        2. 3.2.2. Understanding Type Safety
        3. 3.2.3. Understanding Automatic Memory Management
        4. 3.2.4. Understanding the Just-In-Time Compiler
        5. 3.2.5. Understanding Parallel Processing
        6. 3.2.6. Understanding Unmanaged/Native Code Support
        7. 3.2.7. Understanding the .NET Technology Spectrum
          1. 3.2.7.1. Understanding ASP.NET
            1. 3.2.7.1.1. Related .NET Technologies
            2. 3.2.7.1.2. Further Reading
          2. 3.2.7.2. Understanding LINQ
            1. 3.2.7.2.1. Related .NET Technologies
            2. 3.2.7.2.2. Further Reading
          3. 3.2.7.3. Understanding the Task Parallel Library
            1. 3.2.7.3.1. Related .NET Technologies
            2. 3.2.7.3.2. Further Reading
          4. 3.2.7.4. Understanding User Interfaces
            1. 3.2.7.4.1. Related .NET Technologies
            2. 3.2.7.4.2. Further Reading
          5. 3.2.7.5. Understanding ADO.NET
            1. 3.2.7.5.1. Related .NET Technologies
            2. 3.2.7.5.2. Further Reading
          6. 3.2.7.6. Understanding the Windows Communication Foundation
            1. 3.2.7.6.1. Related .NET Technologies
            2. 3.2.7.6.2. Further Reading
      3. 3.3. Understanding .NET Cross-Platform Support
      4. 3.4. Summary
  6. II. The C# Language
    1. 4. C# Fundamentals and Keyword Reference
      1. 4.1. Language Fundamentals
        1. 4.1.1. A Simple C# Program
        2. 4.1.2. C# Syntax
          1. 4.1.2.1. Identifiers
          2. 4.1.2.2. Keywords
          3. 4.1.2.3. Literals
          4. 4.1.2.4. Operators
          5. 4.1.2.5. Punctuators
          6. 4.1.2.6. Statements
          7. 4.1.2.7. Comments
        3. 4.1.3. Types
          1. 4.1.3.1. Value Types
          2. 4.1.3.2. Reference Types
          3. 4.1.3.3. Definite Assignment and Null References
      2. 4.2. Common Programming Tasks
        1. 4.2.1. Assigning Values
        2. 4.2.2. Making Comparisons
        3. 4.2.3. Performing Selections
          1. 4.2.3.1. Using an if Statement
            1. 4.2.3.1.1. Adding else if Clauses
            2. 4.2.3.1.2. Adding an else Clause
          2. 4.2.3.2. Using a switch Statement
            1. 4.2.3.2.1. Jumping to Another switch Section
        4. 4.2.4. Iterating Data Items
          1. 4.2.4.1. Using a for Loop
            1. 4.2.4.1.1. Breaking Out of a for Loop
            2. 4.2.4.1.2. Continuing to the Next Iteration
          2. 4.2.4.2. Using a foreach Loop
          3. 4.2.4.3. Using a do...while Loop
          4. 4.2.4.4. Using a while Loop
      3. 4.3. Keyword and Operator Reference
        1. 4.3.1. Type Keywords
          1. 4.3.1.1. bool
            1. 4.3.1.1.1. Example
            2. 4.3.1.1.2. References
          2. 4.3.1.2. byte, sbyte
            1. 4.3.1.2.1. Example
            2. 4.3.1.2.2. References
          3. 4.3.1.3. char
            1. 4.3.1.3.1. Example
            2. 4.3.1.3.2. References
          4. 4.3.1.4. class
            1. 4.3.1.4.1. Example
            2. 4.3.1.4.2. References
          5. 4.3.1.5. decimal, double, float
            1. 4.3.1.5.1. Example
            2. 4.3.1.5.2. References
          6. 4.3.1.6. delegate
            1. 4.3.1.6.1. Example
            2. 4.3.1.6.2. References
          7. 4.3.1.7. dynamic
            1. 4.3.1.7.1. Example
            2. 4.3.1.7.2. References
          8. 4.3.1.8. enum
            1. 4.3.1.8.1. Example
            2. 4.3.1.8.2. References
          9. 4.3.1.9. interface
            1. 4.3.1.9.1. Example
            2. 4.3.1.9.2. References
          10. 4.3.1.10. object
            1. 4.3.1.10.1. Example
            2. 4.3.1.10.2. References
          11. 4.3.1.11. string
            1. 4.3.1.11.1. Example
            2. 4.3.1.11.2. References
          12. 4.3.1.12. struct
            1. 4.3.1.12.1. Example
            2. 4.3.1.12.2. References
          13. 4.3.1.13. short, ushort, int, uint, long, ulong
            1. 4.3.1.13.1. Example
            2. 4.3.1.13.2. References
          14. 4.3.1.14. void
            1. 4.3.1.14.1. Example
            2. 4.3.1.14.2. References
          15. 4.3.1.15. var
            1. 4.3.1.15.1. Example
            2. 4.3.1.15.2. References
        2. 4.3.2. Modifiers
          1. 4.3.2.1. public, protected, private, internal
            1. 4.3.2.1.1. Example
            2. 4.3.2.1.2. References
          2. 4.3.2.2. abstract
            1. 4.3.2.2.1. Example
            2. 4.3.2.2.2. References
          3. 4.3.2.3. const
            1. 4.3.2.3.1. Example
            2. 4.3.2.3.2. References
          4. 4.3.2.4. event
            1. 4.3.2.4.1. Example
            2. 4.3.2.4.2. References
          5. 4.3.2.5. in, out
            1. 4.3.2.5.1. Example
            2. 4.3.2.5.2. References
          6. 4.3.2.6. override
            1. 4.3.2.6.1. Example
            2. 4.3.2.6.2. References
          7. 4.3.2.7. readonly
            1. 4.3.2.7.1. Example
            2. 4.3.2.7.2. References
          8. 4.3.2.8. sealed
            1. 4.3.2.8.1. Example
            2. 4.3.2.8.2. References
          9. 4.3.2.9. static
            1. 4.3.2.9.1. References
          10. 4.3.2.10. virtual
            1. 4.3.2.10.1. Example
            2. 4.3.2.10.2. References
        3. 4.3.3. Selection Keywords
          1. 4.3.3.1. if, else
            1. 4.3.3.1.1. References
          2. 4.3.3.2. switch, case, default
            1. 4.3.3.2.1. References
        4. 4.3.4. Iterator Keywords
          1. 4.3.4.1. for
            1. 4.3.4.1.1. References
          2. 4.3.4.2. foreach
            1. 4.3.4.2.1. References
          3. 4.3.4.3. do, while
            1. 4.3.4.3.1. References
        5. 4.3.5. Jump Keywords
          1. 4.3.5.1. break
            1. 4.3.5.1.1. References
          2. 4.3.5.2. continue
            1. 4.3.5.2.1. References
          3. 4.3.5.3. goto
            1. 4.3.5.3.1. References
          4. 4.3.5.4. return
            1. 4.3.5.4.1. Example
            2. 4.3.5.4.2. References
        6. 4.3.6. Exception Handling Keywords
          1. 4.3.6.1. throw
            1. 4.3.6.1.1. Example
            2. 4.3.6.1.2. References
          2. 4.3.6.2. try, catch, finally
            1. 4.3.6.2.1. Example
            2. 4.3.6.2.2. References
        7. 4.3.7. Arithmetic Overflow Keywords
          1. 4.3.7.1. checked, unchecked
            1. 4.3.7.1.1. References
        8. 4.3.8. Synchronization Keywords
          1. 4.3.8.1. lock
            1. 4.3.8.1.1. Example
            2. 4.3.8.1.2. References
        9. 4.3.9. Parameter Keywords
          1. 4.3.9.1. params
            1. 4.3.9.1.1. Example
            2. 4.3.9.1.2. References
          2. 4.3.9.2. ref
            1. 4.3.9.2.1. Example
            2. 4.3.9.2.2. References
          3. 4.3.9.3. out
            1. 4.3.9.3.1. Example
            2. 4.3.9.3.2. References
        10. 4.3.10. Namespace Keywords
          1. 4.3.10.1. namespace
            1. 4.3.10.1.1. Example
            2. 4.3.10.1.2. References
          2. 4.3.10.2. using
            1. 4.3.10.2.1. Example
            2. 4.3.10.2.2. References
        11. 4.3.11. Literal Keywords
          1. 4.3.11.1. null
            1. 4.3.11.1.1. Example
            2. 4.3.11.1.2. References
          2. 4.3.11.2. true, false
            1. 4.3.11.2.1. Example
            2. 4.3.11.2.2. References
        12. 4.3.12. Object Keywords
          1. 4.3.12.1. is, as
            1. 4.3.12.1.1. References
          2. 4.3.12.2. new
            1. 4.3.12.2.1. References
          3. 4.3.12.3. typeof
            1. 4.3.12.3.1. References
        13. 4.3.13. LINQ Keywords
        14. 4.3.14. Other Keywords
          1. 4.3.14.1. base
            1. 4.3.14.1.1. Example
            2. 4.3.14.1.2. References
          2. 4.3.14.2. get, set, value
            1. 4.3.14.2.1. Example
            2. 4.3.14.2.2. References
          3. 4.3.14.3. global
            1. 4.3.14.3.1. References
          4. 4.3.14.4. implicit, explicit
            1. 4.3.14.4.1. References
          5. 4.3.14.5. operator
            1. 4.3.14.5.1. References
          6. 4.3.14.6. partial
            1. 4.3.14.6.1. References
          7. 4.3.14.7. using
            1. 4.3.14.7.1. References
          8. 4.3.14.8. this
            1. 4.3.14.8.1. References
          9. 4.3.14.9. yield
            1. 4.3.14.9.1. References
        15. 4.3.15. Operators
          1. 4.3.15.1. [ ] Operator
            1. 4.3.15.1.1. References
          2. 4.3.15.2. ( ) Operator
            1. 4.3.15.2.1. References
          3. 4.3.15.3. Dot (.) Operator
            1. 4.3.15.3.1. References
          4. 4.3.15.4. :: Operator
            1. 4.3.15.4.1. References
          5. 4.3.15.5. +, -, *, /, % Operators
            1. 4.3.15.5.1. References
          6. 4.3.15.6. ==, !=, >, >=, <, <= Operators
            1. 4.3.15.6.1. References
          7. 4.3.15.7. ++, +=, --, -= Operators
            1. 4.3.15.7.1. References
          8. 4.3.15.8. &&, || Operators
          9. 4.3.15.9. &, |, ^, ~, <<, >> Operators
            1. 4.3.15.9.1. References
          10. 4.3.15.10. => Operator
            1. 4.3.15.10.1. References
          11. 4.3.15.11. =, +=, -=, *=, /=, %=, &=, >>=, <<=, ^= Operators
            1. 4.3.15.11.1. References
      4. 4.4. Summary
    2. 5. Numeric and Boolean Types
      1. 5.1. Numeric Types
        1. 5.1.1. Using Numeric Literals
          1. 5.1.1.1. Using Literal Suffixes
          2. 5.1.1.2. Using Literal Prefixes
        2. 5.1.2. Implicit and Explicit Numeric Type Conversions
        3. 5.1.3. Using Overflow Checking
        4. 5.1.4. Using Struct Members
          1. 5.1.4.1. Common Members
            1. 5.1.4.1.1. Getting the Range of Supported Values
            2. 5.1.4.1.2. Parsing Numeric Values
          2. 5.1.4.2. Using Type-Specific Members
      2. 5.2. Using Numeric Operators
        1. 5.2.1. Arithmetic Operators
        2. 5.2.2. Unary Operators
        3. 5.2.3. Relational Operators
        4. 5.2.4. Logical Operators
        5. 5.2.5. Assignment Operators
      3. 5.3. Working with Very Large Integer Values
      4. 5.4. The Boolean Type
        1. 5.4.1. Using Boolean Literals
        2. 5.4.2. Using Boolean Results
        3. 5.4.3. Using Struct Members
      5. 5.5. Summary
    3. 6. Classes and Objects
      1. 6.1. Creating a Basic Class
        1. 6.1.1. Adding Features to a Class
          1. 6.1.1.1. Adding Fields
          2. 6.1.1.2. Adding Methods
          3. 6.1.1.3. Adding a Constructor
        2. 6.1.2. Creating Objects from Classes
        3. 6.1.3. Using Objects
          1. 6.1.3.1. Reading and Modifying Fields
          2. 6.1.3.2. References to Common Objects
          3. 6.1.3.3. Using Static Fields
          4. 6.1.3.4. Calling Methods
      2. 6.2. Class Inheritance
        1. 6.2.1. Understanding Inheritance
          1. 6.2.1.1. Overriding Methods
          2. 6.2.1.2. Inheriting Derivations
        2. 6.2.2. Understanding Encapsulation
        3. 6.2.3. Understanding Polymorphism
      3. 6.3. Casting Objects and Type Checking
        1. 6.3.1. Implicit vs. Explicit Casting
        2. 6.3.2. Type Conversion Exceptions
        3. 6.3.3. Avoiding Explicit Cast Exceptions
          1. 6.3.3.1. Testing an Object's Type
          2. 6.3.3.2. Casting Without Exceptions
        4. 6.3.4. Boxing and Unboxing
      4. 6.4. Using Nested Classes
      5. 6.5. Using Class Modifiers
        1. 6.5.1. Creating Static Classes
        2. 6.5.2. Creating Abstract Classes
        3. 6.5.3. Creating Sealed Classes
        4. 6.5.4. Creating Partial Classes
        5. 6.5.5. Using Access Modifiers
      6. 6.6. Summary
    4. 7. Fields
      1. 7.1. Defining and Using Fields
        1. 7.1.1. Defining Fields
        2. 7.1.2. Initializing Fields
        3. 7.1.3. Reading and Updating Fields
          1. 7.1.3.1. Working Directly with Field Values
          2. 7.1.3.2. Allowing Other Classes to Read and Modify Properties
            1. 7.1.3.2.1. Exposing Fields Directly
          3. 7.1.3.3. Exposing Properties with Field Values
          4. 7.1.3.4. Understanding Reference Type Fields
        4. 7.1.4. The Fourth Stage of the Life Cycle
      2. 7.2. Applying Field Modifiers
        1. 7.2.1. Creating Static Fields
        2. 7.2.2. Creating Read-Only Fields
          1. 7.2.2.1. Using the const keyword
          2. 7.2.2.2. Using the readonly Keyword
        3. 7.2.3. Applying Access Modifiers
        4. 7.2.4. Hiding Base Class Fields
        5. 7.2.5. Using the volatile Keyword
      3. 7.3. Summary
    5. 8. Properties, Indexers, and Operators
      1. 8.1. Creating a Property
        1. 8.1.1. Creating a Field-Backed Property
        2. 8.1.2. Using a Property
        3. 8.1.3. Creating an Automatically Implemented Property
        4. 8.1.4. Creating an Asymmetric Property
        5. 8.1.5. Creating a Computed Property
        6. 8.1.6. Mapping a Property Type to a Field Type
        7. 8.1.7. Using Access Modifiers
        8. 8.1.8. Using Other Modifiers
          1. 8.1.8.1. Using the virtual and override Modifiers
          2. 8.1.8.2. Using the abstract Modifier
          3. 8.1.8.3. Using the sealed Keyword
          4. 8.1.8.4. Using the static Keyword
      2. 8.2. Creating an Indexer
        1. 8.2.1. Using Multiple Indexers
        2. 8.2.2. Creating a Validating Indexer
        3. 8.2.3. Creating an Indexer with Multiple Arguments
      3. 8.3. Creating Custom Operators
        1. 8.3.1. Creating Custom Unary Operators
        2. 8.3.2. Creating Custom Binary Operators
        3. 8.3.3. Creating Custom Conversion Operators
      4. 8.4. Summary
    6. 9. Methods
      1. 9.1. Creating and Using a Simple Method
        1. 9.1.1. Defining the Method Name
        2. 9.1.2. Defining the Result Type
        3. 9.1.3. Defining the Parameters
        4. 9.1.4. Defining the Modifiers
        5. 9.1.5. Defining the Method Body
        6. 9.1.6. Using the Methods
      2. 9.2. Understanding Parameters
        1. 9.2.1. Using Value Parameters
        2. 9.2.2. Using Reference Parameters
        3. 9.2.3. Using Output Parameters
        4. 9.2.4. Using Parameter Arrays
        5. 9.2.5. Using Optional Parameters
        6. 9.2.6. Using Named Parameters
      3. 9.3. Understanding Method Bodies
        1. 9.3.1. Using Local Variables
          1. 9.3.1.1. Naming Variables
          2. 9.3.1.2. Understanding Variable Scope and Lifetime
        2. 9.3.2. Using Method Results
      4. 9.4. Understanding Method Modifiers
        1. 9.4.1. Using Access Modifiers
        2. 9.4.2. Creating Static Methods
        3. 9.4.3. Creating Virtual Methods
        4. 9.4.4. Creating Sealed Methods
        5. 9.4.5. Creating Abstract Methods
      5. 9.5. Overloading Methods
      6. 9.6. Hiding and Overriding Methods
        1. 9.6.1. Hiding Methods
        2. 9.6.2. Overriding Methods
        3. 9.6.3. Sealing Methods
        4. 9.6.4. Understanding Method Specialization
      7. 9.7. Special Methods
        1. 9.7.1. The Main Method
        2. 9.7.2. Constructors
          1. 9.7.2.1. Using the Default Constructor
          2. 9.7.2.2. Initializing Properties and Fields at Construction
          3. 9.7.2.3. Overloading Constructors
            1. 9.7.2.3.1. Calling One Constructor from Another
            2. 9.7.2.3.2. Using Optional Parameters in a Constructor
          4. 9.7.2.4. Calling Base Class Constructors
            1. 9.7.2.4.1. Creating Instances of a Derived Type
          5. 9.7.2.5. Controlling Access to Constructors
          6. 9.7.2.6. Creating Copy Constructors
          7. 9.7.2.7. Using Static Constructors
          8. 9.7.2.8. Creating Factory Methods
        3. 9.7.3. Destructors
        4. 9.7.4. Iterator Blocks
          1. 9.7.4.1. Using the yield Keyword
          2. 9.7.4.2. Exposing Field Iterators
          3. 9.7.4.3. Using Multiple yield Statements
          4. 9.7.4.4. Using Named Iterator Blocks
        5. 9.7.5. Partial Methods
        6. 9.7.6. Abstract Methods
        7. 9.7.7. Extension Methods
      8. 9.8. Summary
    7. 10. Delegates, Events, and Anonymous Methods
      1. 10.1. Using Delegates
        1. 10.1.1. Using Delegates for Callbacks
        2. 10.1.2. Multicasting with Delegates
        3. 10.1.3. Delegating Selectively
        4. 10.1.4. Interrogating Delegates
      2. 10.2. Using Events
        1. 10.2.1. Defining and Publishing EventHandler Pattern Events
        2. 10.2.2. Creating Nongeneric Events
        3. 10.2.3. Creating Events Without Custom Data
        4. 10.2.4. Applying Modifiers to Events
      3. 10.3. Using Action and Func Delegates
        1. 10.3.1. Using Action Delegates
        2. 10.3.2. Using Func Delegates
      4. 10.4. Anonymous Methods
        1. 10.4.1. Capturing Outer Variables
      5. 10.5. Lambda Expressions
      6. 10.6. Summary
    8. 11. Namespaces
      1. 11.1. Consuming Namespaces
        1. 11.1.1. Using Fully Qualified Names
        2. 11.1.2. Importing Namespaces
      2. 11.2. Creating Namespaces
        1. 11.2.1. Nesting Namespaces
        2. 11.2.2. Logically Nesting Namespaces
        3. 11.2.3. Spreading Namespaces Across Files
        4. 11.2.4. Adding Types to Existing Namespaces
      3. 11.3. Disambiguating Namespaces and Types
        1. 11.3.1. Disambiguation with Fully Qualified Names
        2. 11.3.2. Disambiguating with Aliases
        3. 11.3.3. Aliasing Namespaces
        4. 11.3.4. Resolving Type or Namespace Hiding
      4. 11.4. Summary
    9. 12. Interfaces, Structs, and Enums
      1. 12.1. Using Interfaces
        1. 12.1.1. Defining and Using a Simple Interface
          1. 12.1.1.1. Defining an Interface
          2. 12.1.1.2. Implementing an Interface
          3. 12.1.1.3. Using an Interface
        2. 12.1.2. Specifying Interface Members
          1. 12.1.2.1. Specifying Methods
          2. 12.1.2.2. Specifying Properties
          3. 12.1.2.3. Specifying an Event
          4. 12.1.2.4. Specifying an Indexer
        3. 12.1.3. Deriving Interfaces
          1. 12.1.3.1. Deriving from Multiple Base Interfaces
        4. 12.1.4. Defining a Partial Interface
        5. 12.1.5. Implementing Interfaces
          1. 12.1.5.1. Implementing Multiple Interfaces
          2. 12.1.5.2. Explicitly Implementing an Interface
          3. 12.1.5.3. Inheriting Interface Implementations
          4. 12.1.5.4. Implementing an Interface in an Abstract Class
      2. 12.2. Using Structs
        1. 12.2.1. Defining and Instantiating a Struct
          1. 12.2.1.1. Implementing Interfaces
        2. 12.2.2. Differences Between Structs and Classes
          1. 12.2.2.1. Base Structs and Inheritance
          2. 12.2.2.2. Defining Fields
          3. 12.2.2.3. Defining a Struct Constructor
        3. 12.2.3. Copying a Struct
      3. 12.3. Using an Enum
        1. 12.3.1. Defining an Enum
        2. 12.3.2. Using an Enum
        3. 12.3.3. Using Underlying Types and Numeric Values
        4. 12.3.4. Combining Enum Values
      4. 12.4. Summary
    10. 13. Arrays
      1. 13.1. Defining and Initializing Arrays
      2. 13.2. Getting and Setting Array Values
      3. 13.3. Using Array Initializers
      4. 13.4. Enumerating Arrays
        1. 13.4.1. Enumerating with a for Loop
        2. 13.4.2. Enumerating with a foreach Loop
        3. 13.4.3. Enumerating Using IEnumerator and IEnumerator<T>
        4. 13.4.4. Breaking from Enumerations
      5. 13.5. Using System.Array Members
        1. 13.5.1. Sorting Arrays
        2. 13.5.2. Processing All of the Elements in an Array
        3. 13.5.3. Resizing and Copying an Array
        4. 13.5.4. Finding Items in an Array
      6. 13.6. Using Arrays with LINQ
      7. 13.7. Using Arrays as Collections
      8. 13.8. Using Multidimensional Arrays
        1. 13.8.1. Using Rectangular Arrays
          1. 13.8.1.1. Getting and Setting Rectangular Array Values
          2. 13.8.1.2. Using Rectangular Array Initializers
          3. 13.8.1.3. Enumerating a Rectangular Array
          4. 13.8.1.4. Creating Rectangular Arrays with Additional Dimensions
        2. 13.8.2. Using Jagged Arrays
          1. 13.8.2.1. Getting and Setting Jagged Array Values
          2. 13.8.2.2. Using Jagged Array Initializers
          3. 13.8.2.3. Enumerating a Jagged Array
      9. 13.9. Summary
    11. 14. Exceptions
      1. 14.1. Handling Exceptions
        1. 14.1.1. Using try Statements and catch Clauses
        2. 14.1.2. Handling Different Exception Types
          1. 14.1.2.1. Using Specific catch Clauses
          2. 14.1.2.2. Using General catch Clauses
          3. 14.1.2.3. Omitting catch Clauses
        3. 14.1.3. Nesting try Statements
        4. 14.1.4. Using Exception Members
        5. 14.1.5. Using finally Clauses
      2. 14.2. Throwing Exceptions
        1. 14.2.1. Rethrowing Exceptions
        2. 14.2.2. Creating and Throwing Custom Exceptions
        3. 14.2.3. Throwing Meaningful Exceptions
          1. 14.2.3.1. Mapping One Exception Type to Another
          2. 14.2.3.2. Creating Exception Chains
          3. 14.2.3.3. Aggregating Exceptions
            1. 14.2.3.3.1. Selectively Handling Aggregated Exceptions
      3. 14.3. Summary
    12. 15. Generic and Anonymous Types
      1. 15.1. Using Generic Types
        1. 15.1.1. Defining a Generic Class
        2. 15.1.2. Creating Objects from Generic Classes
        3. 15.1.3. Implementing and Using Generic Class Members
        4. 15.1.4. Defining Multiple Parameter Types
        5. 15.1.5. Casting from Parameterized Types
        6. 15.1.6. Constraining Parameterized Types
          1. 15.1.6.1. Applying Multiple Constrains to a Parameterized Type
          2. 15.1.6.2. Constraining Multiple Parameterized Types
        7. 15.1.7. Defining a Method-Specific Parameterized Type
        8. 15.1.8. Deriving from a Generic Base Class
          1. 15.1.8.1. Inheriting Type Deferral
            1. 15.1.8.1.1. Applying Further Constraints on an Inherited Type Parameter
          2. 15.1.8.2. Specifying Parameterized Types
        9. 15.1.9. Creating Generic Interfaces
        10. 15.1.10. Creating Generic Structs
        11. 15.1.11. Type Variance
          1. 15.1.11.1. Covariance
          2. 15.1.11.2. Contravariance
          3. 15.1.11.3. Combining Contravariance and Covariance
        12. 15.1.12. Using the default Keyword
      2. 15.2. Using Anonymous Types
      3. 15.3. Summary
    13. 16. Strings and Characters
      1. 16.1. Working with Characters
        1. 16.1.1. Expressing Characters Using Literals
        2. 16.1.2. Performing Operations on Characters
        3. 16.1.3. Using Struct Members
      2. 16.2. Using Strings
        1. 16.2.1. Expressing Strings Using String Literals
          1. 16.2.1.1. Using String Escape Sequences and Verbatim Literals
        2. 16.2.2. Performing Operations on Strings
          1. 16.2.2.1. Comparing Strings
          2. 16.2.2.2. Combining Strings
          3. 16.2.2.3. Reading Individual Characters
          4. 16.2.2.4. Enumerating a String
          5. 16.2.2.5. Using Strings in a switch Statement
        3. 16.2.3. Using Regular Expressions
        4. 16.2.4. Using Class Members
          1. 16.2.4.1. Manipulating Strings
          2. 16.2.4.2. Searching Strings
          3. 16.2.4.3. Other Class Members
      3. 16.3. Using the StringBuilder Class
        1. 16.3.1. Creating a StringBuilder Object
        2. 16.3.2. Using a StringBuilder Object
          1. 16.3.2.1. Using the Append and Insert Methods
          2. 16.3.2.2. Using the StringBuilder Indexer
      4. 16.4. Formatting Strings
        1. 16.4.1. Using Composite Formatting
          1. 16.4.1.1. Other Composite Formatting Methods
          2. 16.4.1.2. Specifying Alignment
          3. 16.4.1.3. Escaping Braces
        2. 16.4.2. Formatting Types
          1. 16.4.2.1. Using a Format Component
        3. 16.4.3. Creating String Representations of Custom Types
        4. 16.4.4. Performing Custom Composite Formatting
      5. 16.5. Summary
    14. 17. Attributes
      1. 17.1. Using Attributes
        1. 17.1.1. Applying Attributes with Parameters
      2. 17.2. Testing for an Attribute
        1. 17.2.1. Testing for an Attribute Applied to a Class
        2. 17.2.2. Testing for an Attribute Applied to a Field
        3. 17.2.3. Testing for an Attribute Applied to a Property
        4. 17.2.4. Testing for an Attribute Applied to a Method
      3. 17.3. Creating a Custom Attribute
        1. 17.3.1. Using a Custom Attribute
        2. 17.3.2. Defining Properties in a Custom Attribute
        3. 17.3.3. Controlling How a Custom Attribute Can Be Used
        4. 17.3.4. Controlling Attribute Inheritance
      4. 17.4. Summary
    15. 18. Garbage Collection
      1. 18.1. Explicitly Running the Garbage Collector
      2. 18.2. Implementing a Destructor
        1. 18.2.1. Destructors vs. Finalizers
        2. 18.2.2. Problems with Destructors
          1. 18.2.2.1. Performance Impact
          2. 18.2.2.2. Uncertain Execution
          3. 18.2.2.3. Uncertain Ordering
      3. 18.3. Using Disposal
      4. 18.4. Using Weak References
      5. 18.5. Summary
  7. III. The .NET Class Library
    1. 19. Collections
      1. 19.1. The ICollection<T> Interface
      2. 19.2. Generic Lists
        1. 19.2.1. The IList<T> Interface
        2. 19.2.2. The List<T> Collection
          1. 19.2.2.1. Adding, Retrieving, and Removing Items
          2. 19.2.2.2. Finding List Items
            1. 19.2.2.2.1. Finding Items Using Binary Searches
            2. 19.2.2.2.2. Finding Items Using Predicates
            3. 19.2.2.2.3. Finding Items with LastIndexOf
          3. 19.2.2.3. Sorting List Items
          4. 19.2.2.4. Processing Items
          5. 19.2.2.5. Other List<T> Members
        3. 19.2.3. The LinkedList<T> Collection
          1. 19.2.3.1. Adding, Retrieving, and Removing Items
          2. 19.2.3.2. Finding List Items
        4. 19.2.4. The SortedList<TKey, TVal> Collection
          1. 19.2.4.1. Adding, Retrieving, and Removing Items
          2. 19.2.4.2. Other SortedList<TKey, TVal> Members
      3. 19.3. Generic Dictionaries
        1. 19.3.1. The IDictionary<TKey, TVal> Interface
        2. 19.3.2. The KeyValuePair<TKey, TVal> Structure
        3. 19.3.3. The Dictionary<TKey, TVal> Collection
          1. 19.3.3.1. Adding, Retrieving, and Removing Items
          2. 19.3.3.2. Other Dictionary<TKey, TVal> Members
        4. 19.3.4. The SortedDictionary<TKey, TVal> Collection
      4. 19.4. Generic Sets
        1. 19.4.1. The ISet<T> Interface
        2. 19.4.2. The HashSet<T> Collection
        3. 19.4.3. The SortedSet<T> Collection
      5. 19.5. Generic Queues and Stacks
        1. 19.5.1. The Queue<T> Collection
        2. 19.5.2. The Stack<T> Collection
      6. 19.6. Other Generic Collection Interfaces
        1. 19.6.1. The IComparer<T> Interface
        2. 19.6.2. The IEqualityComparer<T> Interface
      7. 19.7. Treating Arrays as Collections
      8. 19.8. Creating Constrained Collections
        1. 19.8.1. Read-Only Lists
        2. 19.8.2. Other Read-Only Collections
      9. 19.9. Legacy Collections
      10. 19.10. Summary
    2. 20. Files, Streams, and IO
      1. 20.1. Working with Files and Directories
        1. 20.1.1. Using the System.IO.Directory Class
          1. 20.1.1.1. Enumerating Files and Directories
            1. 20.1.1.1.1. Filtering File and Directory Results
          2. 20.1.1.2. Getting and Setting Information for a File or Directory
          3. 20.1.1.3. Changing the Current Working Directory
        2. 20.1.2. Using the FileInfo and DirectoryInfo Classes
          1. 20.1.2.1. Using the FileInfo Class
          2. 20.1.2.2. Using the DirectoryInfo Class
        3. 20.1.3. Using the System.IO.File Class
          1. 20.1.3.1. Using the File Convenience Methods
          2. 20.1.3.2. Using the Stream, Reader, and Writer Methods
        4. 20.1.4. Using the System.IO.Path Class
        5. 20.1.5. Monitoring for Changes
          1. 20.1.5.1. Filtering the Monitored Files and Directories
          2. 20.1.5.2. Filtering the Triggers for a Change Event
      2. 20.2. Working with Streams, Readers, and Writers
        1. 20.2.1. Using Streams
          1. 20.2.1.1. Using the System.IO.Stream Class (in Detail)
            1. 20.2.1.1.1. Writing to a Stream
            2. 20.2.1.1.2. Seeking Within a Stream
            3. 20.2.1.1.3. Reading from a Stream
            4. 20.2.1.1.4. Replacing Data in a Stream
          2. 20.2.1.2. Using Base Streams
            1. 20.2.1.2.1. Using the MemoryStream Class
            2. 20.2.1.2.2. Using the FileStream Class
          3. 20.2.1.3. Using Pass-Through Streams
            1. 20.2.1.3.1. Using a Buffered Pass-Through Stream
            2. 20.2.1.3.2. Compressing Data with Pass-Through Streams
        2. 20.2.2. Using Readers and Writers
          1. 20.2.2.1. Reading and Writing Binary Data
          2. 20.2.2.2. Reading and Writing Textual Data
      3. 20.3. Summary
    3. 21. Networking & WCF
      1. 21.1. Requesting Data
        1. 21.1.1. Using WebClient Members to Configure a Request
        2. 21.1.2. Using WebClient Members to Retrieve Data
          1. 21.1.2.1. Getting the WebClient Response Headers
        3. 21.1.3. Using WebClient Events
      2. 21.2. Programming with Sockets
        1. 21.2.1. Creating a Simple TCP Client & Server
          1. 21.2.1.1. Creating the Server
          2. 21.2.1.2. Creating the Client
        2. 21.2.2. Writing a Parallel Server
      3. 21.3. The Windows Communication Foundation
        1. 21.3.1. Creating the WCF Server
          1. 21.3.1.1. Creating the Service Contract
        2. 21.3.2. Creating the WCF Client
      4. 21.4. Other Useful Network Classes
        1. 21.4.1. Writing a Simple Web Server
        2. 21.4.2. Using Connectionless Networking
        3. 21.4.3. Using the Domain Name System
      5. 21.5. Summary
    4. 22. Time & Dates
      1. 22.1. Measuring Small Amounts of Time
      2. 22.2. Working with Periods of Time
        1. 22.2.1. Creating and Using TimeSpan Values
        2. 22.2.2. Performing Operations on TimeSpan Values
        3. 22.2.3. Formatting TimeSpan Strings
          1. 22.2.3.1. Creating Custom TimeSpan Format Strings
      3. 22.3. Working with Particular Dates and Times
        1. 22.3.1. Creating and Using DateTime Values
        2. 22.3.2. Performing Operations on DateTime Values
        3. 22.3.3. Formatting DateTime Strings
          1. 22.3.3.1. Creating Custom DateTime Format Strings
      4. 22.4. Summary
    5. 23. Serialization
      1. 23.1. Using Binary Serialization
        1. 23.1.1. Serializing Graphs of Objects
        2. 23.1.2. Serializing Multiple Objects to a Single Stream
        3. 23.1.3. Selectively Serializing Fields
        4. 23.1.4. Using Serialization Callbacks
        5. 23.1.5. Version Tolerance
          1. 23.1.5.1. Adding Tolerance for Specific Changes
      2. 23.2. Using SOAP Serialization
        1. 23.2.1. Version Tolerance
        2. 23.2.2. Serializing Generic Objects
      3. 23.3. Using XML Serialization
        1. 23.3.1. Selectively Serializing Fields
        2. 23.3.2. Mapping Members to Elements and Attributes
        3. 23.3.3. Changing the Name for Attributes and Elements
      4. 23.4. Using Data Contract Serialization
        1. 23.4.1. Preparing a Class for Data Contract Serialization
        2. 23.4.2. Generating Portable XML
        3. 23.4.3. Generating .NET-specific XML
        4. 23.4.4. Generating JSON
      5. 23.5. Summary
    6. 24. Parallel Programming
      1. 24.1. Understanding Single- and Multi-Threaded Execution
      2. 24.2. Getting Started with Tasks
        1. 24.2.1. Creating a Task
        2. 24.2.2. Starting a Task
        3. 24.2.3. Waiting for a Task
      3. 24.3. Getting Results from Tasks
      4. 24.4. Passing Parameters to a Task
      5. 24.5. Getting the Status of a Task
        1. 24.5.1. Using the Status Properties
      6. 24.6. Canceling Tasks
        1. 24.6.1. Checking and Throwing in a Single Statement
        2. 24.6.2. Cancelling Multiple Tasks
      7. 24.7. Handling Task Exceptions
        1. 24.7.1. Handling an Exception in a Task Body
        2. 24.7.2. Handling an Exception from a Trigger Method
          1. 24.7.2.1. Handling Exceptions from Multiple Tasks
        3. 24.7.3. Dealing with Exceptions using Task Properties
        4. 24.7.4. Using a Custom Exception Escalation Policy
      8. 24.8. Chaining Tasks Together
        1. 24.8.1. Creating a Simple Continuation
        2. 24.8.2. Getting Details of the Antecedent
        3. 24.8.3. Providing a Continuation Result
        4. 24.8.4. Creating Chains of Continuations
        5. 24.8.5. Creating Selective Continuations
      9. 24.9. Sharing Data between Tasks
        1. 24.9.1. Understanding a Critical Region
        2. 24.9.2. Creating a Critical Region
        3. 24.9.3. Avoiding Synchronization
      10. 24.10. Using Concurrent Collections
      11. 24.11. Summary
    7. 25. Asynchronous Methods and Parallel Loops
      1. 25.1. Using Asynchronous Methods
        1. 25.1.1. Using Pre-Built Asynchronous Methods
        2. 25.1.2. Asynchronously Calling Any Method
        3. 25.1.3. Waiting for an Asynchronous Method to Complete
        4. 25.1.4. Mixing Asynchronous Methods and Tasks
      2. 25.2. Using Parallel Loops
        1. 25.2.1. Creating a Parallel ForEach Loop
        2. 25.2.2. Creating a Parallel For Loop
        3. 25.2.3. Breaking and Stopping Parallel Loops
      3. 25.3. Summary
    8. 26. Other Useful Features and Classes
      1. 26.1. Converting Between Types
      2. 26.2. Returning Multiple Results from Methods Using Tuples
      3. 26.3. Aliasing Generic Types
      4. 26.4. Using Nullable Types
        1. 26.4.1. Using the Null-Coalescing Operator
      5. 26.5. Working with the Console
        1. 26.5.1. Reading from and Writing to the Console
        2. 26.5.2. Making the Console Beep
        3. 26.5.3. Modifying the Appearance of the Console
      6. 26.6. Generating Random Numbers
      7. 26.7. Converting Strings to and from Bytes
      8. 26.8. Getting Environment Information
      9. 26.9. Performing Math Operations
      10. 26.10. Using Conditional Compilation
        1. 26.10.1. Using Visual Studio to Define Symbols
        2. 26.10.2. Conditionally Compiling Methods
      11. 26.11. Checking Network Connectivity
        1. 26.11.1. Listening for Connectivity Changes
      12. 26.12. Summary
  8. IV. Data and Databases
    1. 27. LINQ to Objects
      1. 27.1. Performing a Simple LINQ Query
        1. 27.1.1. Understanding LINQ to Objects Data Sources
        2. 27.1.2. Understanding Query Results
          1. 27.1.2.1. Enumerating Results Manually
          2. 27.1.2.2. Using Results as Data Sources
        3. 27.1.3. Understanding Query Types
          1. 27.1.3.1. The Range Variable Type
          2. 27.1.3.2. The Result Type
          3. 27.1.3.3. Explicitly Specifying the Range Variable Type
          4. 27.1.3.4. Letting the Compiler Infer Types
      2. 27.2. Performing LINQ Operations
        1. 27.2.1. Filtering Data
        2. 27.2.2. Projecting Data
          1. 27.2.2.1. Projecting a Single Member
          2. 27.2.2.2. Projecting Anonymous Types
          3. 27.2.2.3. Projecting Derived Data
        3. 27.2.3. Ordering Data
        4. 27.2.4. Grouping Data
          1. 27.2.4.1. Grouping Using a Boolean Value
          2. 27.2.4.2. Grouping Using an Anonymous Type
          3. 27.2.4.3. Querying Grouped Data
      3. 27.3. Using Method Syntax
      4. 27.4. Understanding Deferred Execution
        1. 27.4.1. Reusing Queries
        2. 27.4.2. Referring to Variables
        3. 27.4.3. Forcing Immediate Execution
      5. 27.5. Converting Query Results
      6. 27.6. Using Legacy Collections as LINQ Data Sources
        1. 27.6.1. Explicitly Specifying the Range Variable Type
        2. 27.6.2. Using Cast and OfType Extension Methods
      7. 27.7. Performing Advanced LINQ Operations
        1. 27.7.1. Aggregating Data
        2. 27.7.2. Joining Data
        3. 27.7.3. Creating Combinations of Data
        4. 27.7.4. Creating Additional Range Variables
      8. 27.8. Summary
    2. 28. Parallel LINQ
      1. 28.1. Performing a Parallel LINQ Query
      2. 28.2. Understanding PLINQ Result Ordering
        1. 28.2.1. Preserving Order in a PLINQ query
      3. 28.3. Forcing Parallel Execution
      4. 28.4. Performing Queries without Results
      5. 28.5. Summary
    3. 29. LINQ to XML
      1. 29.1. Using the LINQ XML Classes
        1. 29.1.1. Creating XML Declaratively
          1. 29.1.1.1. Using Arbitrary Types to Create XElements
          2. 29.1.1.2. Creating Other XML Node Types
          3. 29.1.1.3. Creating Valid XML Documents
        2. 29.1.2. Populating an XElement or XDocument with an IEnumerable
        3. 29.1.3. Reading and Writing XML Files
          1. 29.1.3.1. Saving XML
          2. 29.1.3.2. Loading XML
        4. 29.1.4. Processing XML Declaratively
          1. 29.1.4.1. Filtering Elements by Name
          2. 29.1.4.2. Finding All Descendants
        5. 29.1.5. Modifying XML
      2. 29.2. Using LINQ to XML Queries
        1. 29.2.1. Querying XML for Data
        2. 29.2.2. Creating XML from LINQ Queries
        3. 29.2.3. Create Objects from XML
        4. 29.2.4. Modifying and Transforming XML Data
          1. 29.2.4.1. Adding Elements to XML
          2. 29.2.4.2. Creating a CSV File from XML
          3. 29.2.4.3. Creating XML from CSV Data
          4. 29.2.4.4. Changing and Deleting Elements
        5. 29.2.5. Sorting XML
        6. 29.2.6. Grouping XML
        7. 29.2.7. Using Parallel LINQ to Process XML
      3. 29.3. Summary
    4. 30. LINQ to Entities
      1. 30.1. Getting Ready
        1. 30.1.1. Preparing the Database
        2. 30.1.2. Creating the Model
      2. 30.2. Using LINQ to Entities
        1. 30.2.1. Using the Data Model Context
        2. 30.2.2. Using Table Properties and Row Objects
        3. 30.2.3. Understanding the IQueryable<T> Interface
        4. 30.2.4. Enumerating the Results
      3. 30.3. Navigating Using Foreign Key Relationships
        1. 30.3.1. Querying Using Navigation Properties
        2. 30.3.2. Using Navigation Data Efficiently
      4. 30.4. Performing Common Database Operations
        1. 30.4.1. Querying Data
          1. 30.4.1.1. Compiling Queries
          2. 30.4.1.2. Querying Views
          3. 30.4.1.3. Querying Stored Procedures
        2. 30.4.2. Inserting Data into the Database
          1. 30.4.2.1. Inserting Attached Objects
        3. 30.4.3. Updating Data in the Database
        4. 30.4.4. Deleting Data
      5. 30.5. Enabling Concurrency Checking
      6. 30.6. Summary
    5. 31. LINQ to DataSet
      1. 31.1. Connecting to and Querying a Database
        1. 31.1.1. Setting Up the Database
        2. 31.1.2. Creating a Connection to the Database
          1. 31.1.2.1. Storing Connection Strings
        3. 31.1.3. Executing a SQL Query
      2. 31.2. Understanding the DataSet Class
        1. 31.2.1. Enumerating Results with DataTable and DataRow Objects
      3. 31.3. Querying DataSets with LINQ
        1. 31.3.1. Perform Joins on a DataSet
        2. 31.3.2. Comparing Data
          1. 31.3.2.1. Querying for Data Intersects
          2. 31.3.2.2. Subtracting Results
      4. 31.4. Performing Database Operations Using Cached Data
        1. 31.4.1. Inserting Data
        2. 31.4.2. Modifying Data
        3. 31.4.3. Deleting Data
      5. 31.5. Summary
  9. V. User Interfaces
    1. 32. Windows Forms
      1. 32.1. Building a Stand-Alone Window Forms Program
        1. 32.1.1. Creating the Project
        2. 32.1.2. Adding the Controls
        3. 32.1.3. Setting the Control Properties
          1. 32.1.3.1. Configuring the Labels
          2. 32.1.3.2. Configuring the TextBoxes and NumericUpDowns
          3. 32.1.3.3. Configuring the Button
        4. 32.1.4. Adding the MenuStrip and StatusStrip
        5. 32.1.5. Setting the Control Names
        6. 32.1.6. Setting the Tab Order
        7. 32.1.7. Wiring the Controls
          1. 32.1.7.1. Wiring the Quit Menu
          2. 32.1.7.2. Wiring the TextBoxes
          3. 32.1.7.3. Wiring the Button
        8. 32.1.8. Setting the Icon
        9. 32.1.9. Testing the Program
      2. 32.2. Using Windows Forms Data Binding
        1. 32.2.1. Creating the Project and Creating the Data Model
        2. 32.2.2. Creating and Using the Object Data Source
        3. 32.2.3. Formatting the Grid Control
        4. 32.2.4. Loading the Data
        5. 32.2.5. Wiring the Save Button
        6. 32.2.6. Testing the Program
        7. 32.2.7. Two Program Variations
          1. 32.2.7.1. Filtering the Data with LINQ
          2. 32.2.7.2. Displaying Data Fields
      3. 32.3. Windows 7 UI Integration
        1. 32.3.1. Using Aero Glass
      4. 32.4. Summary
    2. 33. Windows Presentation Foundation
      1. 33.1. Building a Stand-Alone WPF Program
        1. 33.1.1. Creating the Project
        2. 33.1.2. Adding the Controls
        3. 33.1.3. Setting the Control Properties
          1. 33.1.3.1. Configuring the Label Controls
          2. 33.1.3.2. Configuring the TextBox Controls
          3. 33.1.3.3. Configuring the TextBlock Control
          4. 33.1.3.4. Configuring the Button
        4. 33.1.4. Adding the StatusBar Item
        5. 33.1.5. Adding the Menu Item
        6. 33.1.6. Setting the Tab Order
        7. 33.1.7. Wiring the Controls
          1. 33.1.7.1. Wiring the Quit Menu
          2. 33.1.7.2. Wiring the TextBox Controls
          3. 33.1.7.3. Wiring the Button
        8. 33.1.8. Managing the Focus
          1. 33.1.8.1. Focusing on the First Control
          2. 33.1.8.2. Selecting the TextBox Text on Focus
        9. 33.1.9. Setting the Program Icon and Window Name
        10. 33.1.10. Testing the Program
      2. 33.2. Using WPF Data Binding
        1. 33.2.1. Formatting the DataGrid Control
        2. 33.2.2. Loading the Data
        3. 33.2.3. Wiring the Button
        4. 33.2.4. Testing the Program
      3. 33.3. Using WPF-Specific Features
        1. 33.3.1. Using WPF Animations
          1. 33.3.1.1. Creating the Project
          2. 33.3.1.2. Adding the Animation
          3. 33.3.1.3. Testing the Animation
          4. 33.3.1.4. Combining Multiple Animations
        2. 33.3.2. Using WPF Commands
          1. 33.3.2.1. Creating the Project
          2. 33.3.2.2. Configuring the Button Controls
          3. 33.3.2.3. Adding and Configuring the MenuItem Control
          4. 33.3.2.4. Binding the Command
          5. 33.3.2.5. Selectively Activating the Command
          6. 33.3.2.6. Using Commands to Set Control Content
      4. 33.4. Summary
    3. 34. ASP.NET
      1. 34.1. Building a Web Forms Program
        1. 34.1.1. Creating the Project
        2. 34.1.2. Adding the Controls
        3. 34.1.3. Setting the Control Properties
          1. 34.1.3.1. Configuring the Labels
          2. 34.1.3.2. Configuring the TextBox Controls
          3. 34.1.3.3. Configuring the Button
        4. 34.1.4. Setting the Tab Order
        5. 34.1.5. Wiring the Button Control
        6. 34.1.6. Setting the Focus
        7. 34.1.7. Testing the Program
      2. 34.2. Using Web Forms Data Binding
        1. 34.2.1. Create the Project and the Entity Data Model
        2. 34.2.2. Adding the Web Form
        3. 34.2.3. Creating the Web Forms Data Source
        4. 34.2.4. Adding the GridView Control
        5. 34.2.5. Testing the Program
      3. 34.3. Using ASP.NET Dynamic Data
        1. 34.3.1. Creating the Project
        2. 34.3.2. Creating the Entity Data Model
        3. 34.3.3. Registering the Data Model
        4. 34.3.4. Testing the Program
        5. 34.3.5. Customizing a Dynamic Data Application
          1. 34.3.5.1. Changing the Name of a Table
          2. 34.3.5.2. Changing the Name and Visibility of a Column
          3. 34.3.5.3. Selecting Tables to Be Displayed
          4. 34.3.5.4. Customizing the Display Template
      4. 34.4. Summary
    4. 35. Silverlight
      1. 35.1. Creating the Swimming Calculator
        1. 35.1.1. Creating the Project
        2. 35.1.2. Defining the Layout
          1. 35.1.2.1. Adding Grid Columns
          2. 35.1.2.2. Adding the StackPanel Controls
        3. 35.1.3. Adding the TextBox Controls
        4. 35.1.4. Adding the Label Controls
        5. 35.1.5. Adding the TextBlock Control
        6. 35.1.6. Adding the Button Control
        7. 35.1.7. Adjusting the Layout
        8. 35.1.8. Wiring the Button
        9. 35.1.9. Adding a Child Window
      2. 35.2. Using a WCF RIA Service
        1. 35.2.1. Creating the Project
        2. 35.2.2. Creating the Data Model
        3. 35.2.3. Creating the Domain Service Class
        4. 35.2.4. Creating the Silverlight Client
          1. 35.2.4.1. Adding the Data
          2. 35.2.4.2. Configuring the DataGrid Control
            1. 35.2.4.2.1. Changing the Columns
          3. 35.2.4.3. Configuring the ComboBox Control
          4. 35.2.4.4. Wiring the ComboBox Control
        5. 35.2.5. Testing the Application
      3. 35.3. Using Silverlight Out-of-Browser Support
        1. 35.3.1. Configuring the Out-of-Browser Support
      4. 35.4. Using a Silverlight Program Out-of-Browser
        1. 35.4.1. Making Installation Part of the Interface
        2. 35.4.2. Using Other Out-of-Browser Features
      5. 35.5. Summary
  10. VI. Advanced Topics
    1. 36. Windows Integration
      1. 36.1. Using the Windows Event Log
        1. 36.1.1. Reading an Event Log
        2. 36.1.2. Writing to an Event Log
          1. 36.1.2.1. Creating the Event Source
          2. 36.1.2.2. Writing Events
      2. 36.2. Using Elevated Privileges
      3. 36.3. Creating a Windows Service
        1. 36.3.1. Creating the Service Class
        2. 36.3.2. Adding the Service Functionality
        3. 36.3.3. Adding the Service Installer
        4. 36.3.4. Add the MSI Installer
        5. 36.3.5. Installing the Service
        6. 36.3.6. Creating the Client
      4. 36.4. Using the Windows Registry
        1. 36.4.1. Searching the Registry
        2. 36.4.2. Reading and Modifying the Registry
      5. 36.5. Summary
    2. 37. Cryptography and Security
      1. 37.1. Encrypting and Decrypting Data
        1. 37.1.1. Creating and Using Encryption Keys
        2. 37.1.2. Encrypting Data
        3. 37.1.3. Decrypting Data
        4. 37.1.4. Using the Windows Data Protection API
      2. 37.2. Using Hash Codes
        1. 37.2.1. Generating a Hash Code
        2. 37.2.2. Verifying a Hash Code
      3. 37.3. Generating Secure Random Numbers
      4. 37.4. Working Securely with Strings
      5. 37.5. Summary
    3. 38. Testing and Debugging
      1. 38.1. Using the Debug and Trace Classes
        1. 38.1.1. Using the Debug Class
          1. 38.1.1.1. Making Assertions
          2. 38.1.1.2. Disabling Debug Statements
          3. 38.1.1.3. Using Debug Listeners
          4. 38.1.1.4. Other Debug Methods
            1. 38.1.1.4.1. Indenting Debug Output
            2. 38.1.1.4.2. Using Categories
        2. 38.1.2. Using the Trace Class
      2. 38.2. Using Static Code Analysis
        1. 38.2.1. Selecting the Code Analysis Rules
        2. 38.2.2. Performing Static Analysis
        3. 38.2.3. Dealing with a Rule Violation
          1. 38.2.3.1. Suppressing a Single Occurrence
          2. 38.2.3.2. Suppressing Every Occurrence
      3. 38.3. Using Code Contracts
        1. 38.3.1. Installing and Enabling Code Contract Support
        2. 38.3.2. Writing Code Contracts
          1. 38.3.2.1. Using Precondition Contracts
          2. 38.3.2.2. Using Postcondition Contracts
          3. 38.3.2.3. Using Assertion Contracts
          4. 38.3.2.4. Using Invariant Contracts
        3. 38.3.3. Using the Static Checker
        4. 38.3.4. Using the Runtime Checker
      4. 38.4. Summary