You are previewing Professional C# 2005.
O'Reilly logo
Professional C# 2005

Book Description

Professional C# 2005 prepares you to program in C#, and it provides the necessary background information on how the .NET architecture works. It provides examples of applications that use a variety of related technologies, including database access, dynamic web pages, advanced graphics, and directory access. The only requirement is that you are familiar with at least one other high-level language used on Windows—either C++, VB, or J++.

It starts with a tutorial on C# and the .NET framework. This introduction assumes no prior knowledge of .NET, but it does move rapidly, on the assumption that the reader is an experienced programmer. Once this background knowledge is established, the book starts to sweep through the vast .NET class library, showing how you can use C# to solve various tasks. This comprehensive coverage is one of the key selling points of previous versions of the book, and is maintained and enhanced with this new edition by adding new chapters on Generics, ObjectSpaces, Yukon, and Indigo. Some reference material is included either as appendices or is available to download from the Wrox website.

After the introduction and initial chapter, the book is divided into a number of sections that cover both the C# language and its application in a variety of areas. Coverage includes:

  • Writing Windows applications and Windows services

  • Writing web pages and web services with ASP.NET

  • Manipulating XML using C# 2005

  • Understanding .NET Assemblies

  • Using ADO.NET to access databases

  • Integration with COM, COM+, and Active Directory

  • Distributed applications with .NET Remoting

  • Generating graphics using C# 2005

  • Accessing files and the Registry, and controlling .NET security

Table of Contents

  1. Copyright
  2. About the Authors
    1. Christian Nagel
      1. Christian Nagel
      2. Bill Evjen
      3. Jay Glynn
      4. Karli Watson
      5. Morgan Skinner
      6. Allen Jones
  3. Credits
  4. Introduction
    1. The Significance of .NET and C#
      1. Advantages of .NET
    2. What's New in the .NET Framework 2.0
      1. SQL Server integration
      2. 64-Bit support
      3. Generics
      4. Anonymous methods
      5. Nullable types
      6. Iterators
      7. Partial Classes
    3. Where C# Fits In
    4. What You Need to Write and Run C# Code
    5. What This Book Covers
      1. Part I: The C# Language
      2. Part II: The .NET Environment
      3. Part III: Data
      4. Part IV: Windows Applications
      5. Part V: Web Applications
      6. Part VI: Communication
      7. Part VII: Interop
      8. Part VIII: Windows Base Services
      9. Part IX: Appendices (Web Site Only)
    6. Conventions
    7. Source Code
    8. Errata
    9. p2p.wrox.com
  5. I. The C# Language
    1. 1. .NET Architecture
      1. 1.1. The Relationship of C# to .NET
      2. 1.2. The Common Language Runtime
        1. 1.2.1. Advantages of Managed Code
          1. 1.2.1.1. Platform independence
          2. 1.2.1.2. Performance improvement
          3. 1.2.1.3. Language interoperability
            1. 1.2.1.3.1. Visual Basic 2005
            2. 1.2.1.3.2. Visual C++ 2005
            3. 1.2.1.3.3. Visual J# 2005
            4. 1.2.1.3.4. Scripting languages
            5. 1.2.1.3.5. COM and COM+
      3. 1.3. A Closer Look at Intermediate Language
        1. 1.3.1. Support for Object Orientation and Interfaces
        2. 1.3.2. Distinct Value and Reference Types
        3. 1.3.3. Strong Data Typing
          1. 1.3.3.1. The importance of strong data typing for language interoperability
            1. 1.3.3.1.1. Common Type System
            2. 1.3.3.1.2. Common Language Specification
          2. 1.3.3.2. Garbage collection
          3. 1.3.3.3. Security
          4. 1.3.3.4. Application domains
        4. 1.3.4. Error Handling with Exceptions
        5. 1.3.5. Use of Attributes
      4. 1.4. Assemblies
        1. 1.4.1. Private Assemblies
        2. 1.4.2. Shared Assemblies
        3. 1.4.3. Reflection
      5. 1.5. .NET Framework Classes
      6. 1.6. Namespaces
      7. 1.7. Creating .NET Applications Using C#
        1. 1.7.1. Creating ASP.NET Applications
          1. 1.7.1.1. Features of ASP.NET
          2. 1.7.1.2. Web Forms
            1. 1.7.1.2.1. Web server controls
          3. 1.7.1.3. XML Web services
        2. 1.7.2. Creating Windows Forms
        3. 1.7.3. Windows Controls
        4. 1.7.4. Windows Services
      8. 1.8. The Role of C# in the .NET Enterprise Architecture
      9. 1.9. Summary
    2. 2. C# Basics
      1. 2.1. Before We Start
      2. 2.2. Your First C# Program
        1. 2.2.1. The Code
        2. 2.2.2. Compiling and Running the Program
        3. 2.2.3. A Closer Look
      3. 2.3. Variables
        1. 2.3.1. Initialization of Variables
        2. 2.3.2. Variable Scope
          1. 2.3.2.1. Scope clashes for local variables
          2. 2.3.2.2. Scope clashes for fields and local variables
        3. 2.3.3. Constants
      4. 2.4. Predefined Data Types
        1. 2.4.1. Value Types and Reference Types
        2. 2.4.2. CTS Types
        3. 2.4.3. Predefined Value Types
          1. 2.4.3.1. Integer types
          2. 2.4.3.2. Floating-point types
          3. 2.4.3.3. The decimal type
          4. 2.4.3.4. The Boolean type
          5. 2.4.3.5. The character type
        4. 2.4.4. Predefined Reference Types
          1. 2.4.4.1. The object type
          2. 2.4.4.2. The string type
      5. 2.5. Flow Control
        1. 2.5.1. Conditional Statements
          1. 2.5.1.1. The if statement
          2. 2.5.1.2. The switch statement
        2. 2.5.2. Loops
          1. 2.5.2.1. The for loop
          2. 2.5.2.2. The while loop
          3. 2.5.2.3. The do...while loop
          4. 2.5.2.4. The foreach loop
        3. 2.5.3. Jump Statements
          1. 2.5.3.1. The goto statement
          2. 2.5.3.2. The break statement
          3. 2.5.3.3. The continue statement
          4. 2.5.3.4. The return statement
      6. 2.6. Enumerations
      7. 2.7. Arrays
      8. 2.8. Namespaces
        1. 2.8.1. The using Statement
        2. 2.8.2. Namespace Aliases
      9. 2.9. The Main() Method
        1. 2.9.1. Multiple Main() Methods
        2. 2.9.2. Passing Arguments to Main()
      10. 2.10. More on Compiling C# Files
      11. 2.11. Console I/O
      12. 2.12. Using Comments
        1. 2.12.1. Internal Comments Within the Source Files
        2. 2.12.2. XML Documentation
      13. 2.13. The C# Preprocessor Directives
        1. 2.13.1. #define and #undef
        2. 2.13.2. #if, #elif, #else, and #endif
        3. 2.13.3. #warning and #error
        4. 2.13.4. #region and #endregion
        5. 2.13.5. #line
        6. 2.13.6. #pragma
      14. 2.14. C# Programming Guidelines
        1. 2.14.1. Rules for Identifiers
        2. 2.14.2. Usage Conventions
          1. 2.14.2.1. Naming conventions
            1. 2.14.2.1.1. Casing of names
            2. 2.14.2.1.2. Name styles
            3. 2.14.2.1.3. Namespace names
            4. 2.14.2.1.4. Names and keywords
          2. 2.14.2.2. Use of properties and methods
          3. 2.14.2.3. Use of fields
      15. 2.15. Summary
    3. 3. Objects and Types
      1. 3.1. Classes and Structs
      2. 3.2. Class Members
        1. 3.2.1. Data Members
        2. 3.2.2. Function Members
          1. 3.2.2.1. Methods
            1. 3.2.2.1.1. Declaring methods
            2. 3.2.2.1.2. Invoking methods
            3. 3.2.2.1.3. Passing parameters to methods
            4. 3.2.2.1.4. ref parameters
            5. 3.2.2.1.5. out parameters
            6. 3.2.2.1.6. Method overloading
          2. 3.2.2.2. Properties
            1. 3.2.2.2.1. Read-only and write-only properties
            2. 3.2.2.2.2. Access modifiers for properties
            3. 3.2.2.2.3. A note about inlining
          3. 3.2.2.3. Constructors
            1. 3.2.2.3.1. Static constructors
            2. 3.2.2.3.2. Calling constructors from other constructors
        3. 3.2.3. readonly Fields
      3. 3.3. Structs
        1. 3.3.1. Structs Are Value Types
        2. 3.3.2. Structs and Inheritance
        3. 3.3.3. Constructors for Structs
      4. 3.4. Partial Classes
      5. 3.5. Static Classes
      6. 3.6. The Object Class
        1. 3.6.1. System.Object Methods
        2. 3.6.2. The ToString() Method
      7. 3.7. Summary
    4. 4. Inheritance
      1. 4.1. Types of Inheritance
        1. 4.1.1. Implementation Versus Interface Inheritance
        2. 4.1.2. Multiple Inheritance
        3. 4.1.3. Structs and Classes
      2. 4.2. Implementation Inheritance
        1. 4.2.1. Virtual Methods
        2. 4.2.2. Hiding Methods
        3. 4.2.3. Calling Base Versions of Functions
        4. 4.2.4. Abstract Classes and Functions
        5. 4.2.5. Sealed Classes and Methods
        6. 4.2.6. Constructors of Derived Classes
          1. 4.2.6.1. Adding a no-parameter constructor in a hierarchy
          2. 4.2.6.2. Adding constructors with parameters to a hierarchy
      3. 4.3. Modifiers
        1. 4.3.1. Visibility Modifiers
        2. 4.3.2. Other Modifiers
      4. 4.4. Interfaces
        1. 4.4.1. Defining and Implementing Interfaces
        2. 4.4.2. Derived Interfaces
      5. 4.5. Summary
    5. 5. Operators and Casts
      1. 5.1. Operators
        1. 5.1.1. Operator Shortcuts
        2. 5.1.2. The Ternary Operator
        3. 5.1.3. The checked and unchecked Operators
        4. 5.1.4. The is Operator
        5. 5.1.5. The as Operator
        6. 5.1.6. The sizeof Operator
        7. 5.1.7. The typeof Operator
        8. 5.1.8. Nullable Types and Operators
        9. 5.1.9. The Null Coalescing Operator
        10. 5.1.10. Operator Precedence
      2. 5.2. Type Safety
        1. 5.2.1. Type Conversions
          1. 5.2.1.1. Implicit conversions
          2. 5.2.1.2. Explicit conversions
        2. 5.2.2. Boxing and Unboxing
      3. 5.3. Comparing Objects for Equality
        1. 5.3.1. Comparing Reference Types for Equality
          1. 5.3.1.1. The ReferenceEquals() method
          2. 5.3.1.2. The virtual Equals() method
          3. 5.3.1.3. The static Equals() method
          4. 5.3.1.4. Comparison operator (==)
        2. 5.3.2. Comparing Value Types for Equality
      4. 5.4. Operator Overloading
        1. 5.4.1. How Operators Work
        2. 5.4.2. Operator Overloading Example: The Vector Struct
          1. 5.4.2.1. Adding more overloads
          2. 5.4.2.2. Overloading the comparison operators
        3. 5.4.3. Which Operators Can You Overload?
      5. 5.5. User-Defined Casts
        1. 5.5.1. Implementing User-Defined Casts
          1. 5.5.1.1. Casts between classes
          2. 5.5.1.2. Casts between base and derived classes
          3. 5.5.1.3. Boxing and unboxing casts
        2. 5.5.2. Multiple Casting
      6. 5.6. Summary
    6. 6. Delegates and Events
      1. 6.1. Delegates
        1. 6.1.1. Declaring Delegates in C#
        2. 6.1.2. Using Delegates in C#
      2. 6.2. Anonymous Methods
        1. 6.2.1. SimpleDelegate Example
        2. 6.2.2. BubbleSorter Example
        3. 6.2.3. Multicast Delegates
      3. 6.3. Events
        1. 6.3.1. The Receiver's View of Events
        2. 6.3.2. Generating Events
      4. 6.4. Summary
    7. 7. Memory Management and Pointers
      1. 7.1. Memory Management under the Hood
        1. 7.1.1. Value Data Types
        2. 7.1.2. Reference Data Types
        3. 7.1.3. Garbage Collection
      2. 7.2. Freeing Unmanaged Resources
        1. 7.2.1. Destructors
        2. 7.2.2. The IDisposable Interface
        3. 7.2.3. Implementing IDisposable and a Destructor
      3. 7.3. Unsafe Code
        1. 7.3.1. Pointers
          1. 7.3.1.1. Writing unsafe code
          2. 7.3.1.2. Pointer syntax
          3. 7.3.1.3. Casting pointers to integer types
          4. 7.3.1.4. Casting between pointer types
          5. 7.3.1.5. void pointers
          6. 7.3.1.6. Pointer arithmetic
          7. 7.3.1.7. The sizeof operator
          8. 7.3.1.8. Pointers to structs: The pointer member access operator
          9. 7.3.1.9. Pointers to class members
        2. 7.3.2. Pointer Example: PointerPlayaround
        3. 7.3.3. Using Pointers to Optimize Performance
          1. 7.3.3.1. Creating stack-based arrays
          2. 7.3.3.2. QuickArray example
      4. 7.4. Summary
    8. 8. Strings and Regular Expressions
      1. 8.1. System.String
        1. 8.1.1. Building Strings
        2. 8.1.2. StringBuilder Members
        3. 8.1.3. Format Strings
          1. 8.1.3.1. How the string is formatted
          2. 8.1.3.2. The FormattableVector example
      2. 8.2. Regular Expressions
        1. 8.2.1. Introduction to Regular Expressions
        2. 8.2.2. The RegularExpressionsPlayaround Example
        3. 8.2.3. Displaying Results
        4. 8.2.4. Matches, Groups, and Captures
      3. 8.3. Summary
    9. 9. Collections
      1. 9.1. Examining Groups of Objects
        1. 9.1.1. Collections
          1. 9.1.1.1. What is a collection?
          2. 9.1.1.2. Adding collection support to the Vector struct
        2. 9.1.2. Array Lists
        3. 9.1.3. The Stack Class
        4. 9.1.4. The Queue Class
        5. 9.1.5. The SortedList Class
        6. 9.1.6. Dictionaries and Hashtables
          1. 9.1.6.1. Dictionaries in real life
          2. 9.1.6.2. Dictionaries in .NET
          3. 9.1.6.3. How the dictionary works
          4. 9.1.6.4. The MortimerPhonesEmployees example
        7. 9.1.7. Generics
      2. 9.2. Summary
    10. 10. Generics
      1. 10.1. Overview
        1. 10.1.1. Performance
        2. 10.1.2. Type Safety
        3. 10.1.3. Binary Code Reuse
        4. 10.1.4. Code Bloat
        5. 10.1.5. Naming Guidelines
      2. 10.2. Generic Collection Classes
        1. 10.2.1. Generic Collections Overview
        2. 10.2.2. Using the List<T> Class
          1. 10.2.2.1. Finding elements
          2. 10.2.2.2. Performing some action
          3. 10.2.2.3. Sorting
          4. 10.2.2.4. Type conversion
        3. 10.2.3. Using the Queue<T> Class
        4. 10.2.4. Using the LinkedList<T>
      3. 10.3. Creating Custom Generic Classes
        1. 10.3.1. Default Values
        2. 10.3.2. Constraints
      4. 10.4. Generic Methods
      5. 10.5. Generic Delegates
      6. 10.6. Other Generic Framework Types
        1. 10.6.1. Nullable<T>
        2. 10.6.2. EventHandler<TEventArgs>
        3. 10.6.3. ArraySegment<T>
      7. 10.7. Summary
    11. 11. Reflection
      1. 11.1. Custom Attributes
        1. 11.1.1. Writing Custom Attributes
          1. 11.1.1.1. AttributeUsage attribute
          2. 11.1.1.2. Specifying attribute parameters
          3. 11.1.1.3. Specifying optional attribute parameters
        2. 11.1.2. Custom Attribute Example: WhatsNewAttributes
          1. 11.1.2.1. The WhatsNewAttributes library assembly
          2. 11.1.2.2. The VectorClass assembly
      2. 11.2. Reflection
        1. 11.2.1. The System.Type Class
          1. 11.2.1.1. Type properties
          2. 11.2.1.2. Methods
        2. 11.2.2. The TypeView Example
        3. 11.2.3. The Assembly Class
          1. 11.2.3.1. Finding out about types defined in an assembly
          2. 11.2.3.2. Finding out about custom attributes
        4. 11.2.4. Completing the WhatsNewAttributes Example
      3. 11.3. Summary
    12. 12. Errors and Exceptions
      1. 12.1. Looking into Errors and Exception Handling
        1. 12.1.1. Exception Classes
          1. 12.1.1.1. Base class exception classes
        2. 12.1.2. Catching Exceptions
          1. 12.1.2.1. Implementing multiple catch blocks
          2. 12.1.2.2. Catching exceptions from other code
          3. 12.1.2.3. System.Exception properties
          4. 12.1.2.4. What happens if an exception isn't handled?
          5. 12.1.2.5. Nested try blocks
            1. 12.1.2.5.1. Modifying the type of exception
            2. 12.1.2.5.2. Handling different exceptions in different places
        3. 12.1.3. User-Defined Exception Classes
          1. 12.1.3.1. Catching the user-defined exceptions
          2. 12.1.3.2. Throwing the user-defined exceptions
          3. 12.1.3.3. Defining the exception classes
      2. 12.2. Summary
    13. 13. Threading
      1. 13.1. Threading
      2. 13.2. Applications with Multiple Threads
      3. 13.3. Manipulating Threads
        1. 13.3.1. The ThreadPlayaround Sample
        2. 13.3.2. Thread Priorities
        3. 13.3.3. Synchronization
          1. 13.3.3.1. What is synchronization?
          2. 13.3.3.2. Synchronization issues
            1. 13.3.3.2.1. Don't overuse synchronization
            2. 13.3.3.2.2. Deadlocks
            3. 13.3.3.2.3. Race conditions
      4. 13.4. Creating Threads Using ThreadPool
      5. 13.5. Summary
  6. II. The .NET Environment
    1. 14. Visual Studio 2005
      1. 14.1. Working with Visual Studio 2005
        1. 14.1.1. Creating a Project
          1. 14.1.1.1. Selecting a project type
          2. 14.1.1.2. The newly created console project
          3. 14.1.1.3. Other files created
        2. 14.1.2. Solutions and Projects
          1. 14.1.2.1. Adding another project to the solution
          2. 14.1.2.2. Setting the startup project
        3. 14.1.3. Windows Application Code
        4. 14.1.4. Reading in Visual Studio 6 Projects
        5. 14.1.5. Exploring and Coding a Project
          1. 14.1.5.1. The folding editor
          2. 14.1.5.2. Other windows
            1. 14.1.5.2.1. The Design View window
            2. 14.1.5.2.2. The Properties window
            3. 14.1.5.2.3. The Class View window
            4. 14.1.5.2.4. The Object Browser window
            5. 14.1.5.2.5. The Server Explorer window
          3. 14.1.5.3. Pin buttons
        6. 14.1.6. Building a Project
          1. 14.1.6.1. Building, compiling, and making
          2. 14.1.6.2. Debug and release builds
            1. 14.1.6.2.1. Optimization
            2. 14.1.6.2.2. Debugger symbols
            3. 14.1.6.2.3. Extra source code debugging commands
          3. 14.1.6.3. Selecting a configuration
          4. 14.1.6.4. Editing configurations
        7. 14.1.7. Debugging
          1. 14.1.7.1. Breakpoints
          2. 14.1.7.2. Watches
          3. 14.1.7.3. Exceptions
      2. 14.2. Refactoring
      3. 14.3. Summary
    2. 15. Assemblies
      1. 15.1. What Are Assemblies?
        1. 15.1.1. The Answer to DLL Hell
        2. 15.1.2. Features of Assemblies
        3. 15.1.3. Application Domains and Assemblies
      2. 15.2. Assembly Structure
        1. 15.2.1. Assembly Manifests
        2. 15.2.2. Namespaces, Assemblies, and Components
        3. 15.2.3. Private and Shared Assemblies
        4. 15.2.4. Viewing Assemblies
          1. 15.2.4.1. ildasm symbols
        5. 15.2.5. Building Assemblies
          1. 15.2.5.1. Creating modules and assemblies
          2. 15.2.5.2. Creating assemblies using Visual Studio
      3. 15.3. Cross-Language Support
        1. 15.3.1. The CTS and the CLS
        2. 15.3.2. Language Independence in Action
          1. 15.3.2.1. Writing the C++/CLI class
          2. 15.3.2.2. Writing the Visual Basic class
          3. 15.3.2.3. Writing the C# class
        3. 15.3.3. CLS Requirements
          1. 15.3.3.1. The CLSCompliant attribute
          2. 15.3.3.2. CLS rules
      4. 15.4. Global Assembly Cache
        1. 15.4.1. Native Image Generator
        2. 15.4.2. Global Assembly Cache Viewer
        3. 15.4.3. Global Assembly Cache Utility (gacutil.exe)
      5. 15.5. Creating Shared Assemblies
        1. 15.5.1. Shared Assembly Names
          1. 15.5.1.1. Public key cryptography
          2. 15.5.1.2. Integrity using strong names
        2. 15.5.2. Creating a Shared Assembly
          1. 15.5.2.1. Create a strong name
          2. 15.5.2.2. Install the shared assembly
          3. 15.5.2.3. Using the shared assembly
          4. 15.5.2.4. Delayed signing of assemblies
          5. 15.5.2.5. References
      6. 15.6. Configuration
        1. 15.6.1. Configuration Categories
        2. 15.6.2. Versioning
          1. 15.6.2.1. Version numbers
          2. 15.6.2.2. Getting the version programmatically
          3. 15.6.2.3. Application configuration files
          4. 15.6.2.4. Publisher policy files
            1. 15.6.2.4.1. Create a publisher policy file
            2. 15.6.2.4.2. Create a publisher policy assembly
            3. 15.6.2.4.3. Add the publisher policy assembly to the global assembly cache
            4. 15.6.2.4.4. Overriding publisher policies
          5. 15.6.2.5. Runtime version
        3. 15.6.3. Configuring Directories
          1. 15.6.3.1. <codeBase>
          2. 15.6.3.2. <probing>
      7. 15.7. Summary
    3. 16. .NET Security
      1. 16.1. Code Access Security
        1. 16.1.1. Code Groups
          1. 16.1.1.1. caspol.exe—The Code Access Security Policy tool
          2. 16.1.1.2. Viewing an assembly's code groups
        2. 16.1.2. Code Access Permissions and Permissions Sets
          1. 16.1.2.1. Viewing an assembly's permissions
        3. 16.1.3. Policy Levels: Machine, User, and Enterprise
      2. 16.2. Support for Security in the Framework
        1. 16.2.1. Demanding Permissions
        2. 16.2.2. Requesting Permissions
        3. 16.2.3. Implicit Permission
        4. 16.2.4. Denying Permissions
        5. 16.2.5. Asserting Permissions
        6. 16.2.6. Creating Code Access Permissions
        7. 16.2.7. Declarative Security
      3. 16.3. Managing Security Policies
        1. 16.3.1. The Security Configuration File
        2. 16.3.2. Managing Code Groups and Permissions
        3. 16.3.3. Turning Security On and Off
        4. 16.3.4. Resetting Security Policy
        5. 16.3.5. Creating a Code Group
        6. 16.3.6. Deleting a Code Group
        7. 16.3.7. Changing a Code Group's Permissions
        8. 16.3.8. Creating and Applying Permissions Sets
        9. 16.3.9. Distributing Code Using a Strong Name
        10. 16.3.10. Distributing Code Using Certificates
        11. 16.3.11. Managing Zones
      4. 16.4. Role-Based Security
        1. 16.4.1. The Principal
        2. 16.4.2. Windows Principal
        3. 16.4.3. Roles
        4. 16.4.4. Declarative Role-Based Security
      5. 16.5. Summary
    4. 17. Localization
      1. 17.1. Namespace System.Globalization
        1. 17.1.1. Unicode Issues
        2. 17.1.2. Cultures and Regions
          1. 17.1.2.1. Specific, neutral, and invariant cultures
          2. 17.1.2.2. CurrentCulture and CurrentUICulture
          3. 17.1.2.3. Number formatting
          4. 17.1.2.4. Date formatting
        3. 17.1.3. Cultures in Action
        4. 17.1.4. Sorting
      2. 17.2. Resources
        1. 17.2.1. Creating Resource Files
        2. 17.2.2. Resource File Generator
        3. 17.2.3. ResourceWriter
        4. 17.2.4. Using Resource Files
        5. 17.2.5. The System.Resources Namespace
      3. 17.3. Localization Example Using Visual Studio
        1. 17.3.1. Changing the Culture Programmatically
        2. 17.3.2. Using Custom Resource Messages
        3. 17.3.3. Automatic Fallback for Resources
        4. 17.3.4. Outsourcing Translations
      4. 17.4. Localization with ASP.NET
      5. 17.5. A Custom Resource Reader
        1. 17.5.1. Creating a DatabaseResourceReader
        2. 17.5.2. Creating a DatabaseResourceSet
        3. 17.5.3. Creating a DatabaseResourceManager
        4. 17.5.4. Client Application for DatabaseResourceReader
      6. 17.6. Creating Custom Cultures
      7. 17.7. Summary
    5. 18. Deployment
      1. 18.1. Designing for Deployment
      2. 18.2. Deployment Options
        1. 18.2.1. Xcopy
        2. 18.2.2. Copy Web Tool
        3. 18.2.3. Publishing Web Sites
        4. 18.2.4. Deployment Projects
        5. 18.2.5. ClickOnce
      3. 18.3. Deployment Requirements
      4. 18.4. Simple Deployment
        1. 18.4.1. Xcopy
        2. 18.4.2. Xcopy and Web Applications
        3. 18.4.3. Copy Web Tool
        4. 18.4.4. Publishing a Web Site
      5. 18.5. Installer Projects
        1. 18.5.1. What Is Windows Installer?
        2. 18.5.2. Creating Installers
          1. 18.5.2.1. Simple Client Application
            1. 18.5.2.1.1. Same solution project
          2. 18.5.2.2. Simple Web application
          3. 18.5.2.3. Client from Web server
            1. 18.5.2.3.1. No Touch Deployment
      6. 18.6. ClickOnce
        1. 18.6.1. ClickOnce Operation
        2. 18.6.2. Publishing an Application
        3. 18.6.3. ClickOnce Settings
        4. 18.6.4. Application Cache
        5. 18.6.5. Security
        6. 18.6.6. Advanced Options
          1. 18.6.6.1. File System Editor
          2. 18.6.6.2. Registry Editor
          3. 18.6.6.3. File Types Editor
          4. 18.6.6.4. User Interface Editor
          5. 18.6.6.5. Custom Actions Editor
          6. 18.6.6.6. Launch Conditions Editor
      7. 18.7. Summary
  7. III. Data
    1. 19. Data Access with .NET
      1. 19.1. ADO.NET Overview
        1. 19.1.1. Namespaces
        2. 19.1.2. Shared Classes
        3. 19.1.3. Database-Specific Classes
      2. 19.2. Using Database Connections
        1. 19.2.1. Managing Connection Strings
        2. 19.2.2. Using Connections Efficiently
          1. 19.2.2.1. Option One: try...catch...finally
          2. 19.2.2.2. Option Two: The using block statement
        3. 19.2.3. Transactions
      3. 19.3. Commands
        1. 19.3.1. Executing Commands
          1. 19.3.1.1. ExecuteNonQuery()
          2. 19.3.1.2. ExecuteReader()
          3. 19.3.1.3. ExecuteScalar()
          4. 19.3.1.4. ExecuteXmlReader() (SqlClient Provider Only)
        2. 19.3.2. Calling Stored Procedures
          1. 19.3.2.1. Calling a stored procedure that returns nothing
            1. 19.3.2.1.1. Record update
            2. 19.3.2.1.2. Record deletion
          2. 19.3.2.2. Calling a stored procedure that returns output parameters
            1. 19.3.2.2.1. Record insertion
      4. 19.4. Fast Data Access: The Data Reader
      5. 19.5. Managing Data and Relationships: The DataSet Class
        1. 19.5.1. Data Tables
        2. 19.5.2. Data Columns
          1. 19.5.2.1. Data rows
          2. 19.5.2.2. Schema generation
            1. 19.5.2.2.1. Runtime schema generation
            2. 19.5.2.2.2. Hand-coded schema
        3. 19.5.3. Data Relationships
        4. 19.5.4. Data Constraints
          1. 19.5.4.1. Setting a primary key
          2. 19.5.4.2. Setting a foreign key
          3. 19.5.4.3. Setting Update and Delete constraints
      6. 19.6. XML Schemas
        1. 19.6.1. Generating Code with XSD
      7. 19.7. Populating a DataSet
        1. 19.7.1. Populating a DataSet Class with a Data Adapter
          1. 19.7.1.1. Using a stored procedure in a data adapter
        2. 19.7.2. Populating a DataSet from XML
      8. 19.8. Persisting DataSet Changes
        1. 19.8.1. Updating with Data Adapters
          1. 19.8.1.1. Inserting a new row
          2. 19.8.1.2. Updating an existing row
          3. 19.8.1.3. Deleting a row
        2. 19.8.2. Writing XML Output
      9. 19.9. Working with ADO.NET
        1. 19.9.1. Tiered Development
        2. 19.9.2. Key Generation with SQL Server
        3. 19.9.3. Naming Conventions
          1. 19.9.3.1. Conventions for database tables
          2. 19.9.3.2. Conventions for database columns
          3. 19.9.3.3. Conventions for constraints
          4. 19.9.3.4. Stored procedures
      10. 19.10. Summary
    2. 20. .NET Programming with SQL Server 2005
      1. 20.1. .NET Runtime Host
      2. 20.2. Microsoft.SqlServer.Server
      3. 20.3. User-Defined Types
        1. 20.3.1. Creating UDTs
        2. 20.3.2. Using UDTs
        3. 20.3.3. Using UDTs from Client-Side Code
      4. 20.4. User-Defined Aggregates
        1. 20.4.1. Creating User-Defined Aggregates
        2. 20.4.2. Using User-Defined Aggregates
      5. 20.5. Stored Procedures
        1. 20.5.1. Creating Stored Procedures
        2. 20.5.2. Using Stored Procedures
      6. 20.6. User-Defined Functions
        1. 20.6.1. Creating User-Defined Functions
        2. 20.6.2. Using User-Defined Functions
      7. 20.7. Triggers
        1. 20.7.1. Creating Triggers
        2. 20.7.2. Using Triggers
      8. 20.8. XML Data Type
        1. 20.8.1. Tables with XML Data
        2. 20.8.2. Query of Data
        3. 20.8.3. XML Data Modification Language (XML DML)
        4. 20.8.4. XML Indexes
        5. 20.8.5. Strongly Typed XML
      9. 20.9. Summary
    3. 21. Manipulating XML
      1. 21.1. XML Standards Support in .NET
      2. 21.2. Introducing the System.Xml Namespace
      3. 21.3. Using MSXML in .NET
      4. 21.4. Using System.Xml Classes
      5. 21.5. Reading and Writing Streamed XML
        1. 21.5.1. Using the XmlReader Class
          1. 21.5.1.1. Read methods
          2. 21.5.1.2. Retrieving attribute data
        2. 21.5.2. Validating with XmlReader
        3. 21.5.3. Using the XmlWriter Class
      6. 21.6. Using the DOM in .NET
        1. 21.6.1. Using the XmlDocument Class
          1. 21.6.1.1. Inserting nodes
      7. 21.7. Using XPathNavigators
        1. 21.7.1. The System.Xml.XPath Namespace
          1. 21.7.1.1. XPathDocument
          2. 21.7.1.2. XPathNavigator
          3. 21.7.1.3. XPathNodeIterator
          4. 21.7.1.4. Using classes from the XPath namespace
        2. 21.7.2. The System.Xml.Xsl Namespace
          1. 21.7.2.1. Transforming XML
            1. 21.7.2.1.1. Using XsltArgumentList
      8. 21.8. XML and ADO.NET
        1. 21.8.1. Converting ADO.NET Data to XML
          1. 21.8.1.1. Converting relational data
        2. 21.8.2. Converting XML to ADO.NET Data
        3. 21.8.3. Reading and Writing a DiffGram
      9. 21.9. Serializing Objects in XML
        1. 21.9.1. Serialization without Source Code Access
      10. 21.10. Summary
    4. 22. Working with Active Directory
      1. 22.1. The Architecture of Active Directory
        1. 22.1.1. Features
        2. 22.1.2. Active Directory Concepts
          1. 22.1.2.1. Objects
          2. 22.1.2.2. Schema
          3. 22.1.2.3. Configuration
          4. 22.1.2.4. The Active Directory domain
          5. 22.1.2.5. Domain controller
          6. 22.1.2.6. Site
          7. 22.1.2.7. Domain tree
          8. 22.1.2.8. Forest
          9. 22.1.2.9. Global catalog
          10. 22.1.2.10. Replication
        3. 22.1.3. Characteristics of Active Directory Data
        4. 22.1.4. Schema
      2. 22.2. Administration Tools for Active Directory
        1. 22.2.1. Active Directory Users and Computers
        2. 22.2.2. ADSI Edit
      3. 22.3. Programming Active Directory
        1. 22.3.1. Classes in System.DirectoryServices
        2. 22.3.2. Binding
          1. 22.3.2.1. Protocol
          2. 22.3.2.2. Server name
          3. 22.3.2.3. Port number
          4. 22.3.2.4. Distinguished name
            1. 22.3.2.4.1. Relative distinguished name
            2. 22.3.2.4.2. Default naming context
            3. 22.3.2.4.3. Object identifier
          5. 22.3.2.5. User name
            1. 22.3.2.5.1. Downlevel logon
            2. 22.3.2.5.2. Distinguished name
            3. 22.3.2.5.3. User principal name
          6. 22.3.2.6. Authentication
          7. 22.3.2.7. Binding with the DirectoryEntry class
        3. 22.3.3. Getting Directory Entries
          1. 22.3.3.1.
            1. 22.3.3.1.1. Access a property directly by name
        4. 22.3.4. Object Collections
        5. 22.3.5. Cache
        6. 22.3.6. Creating New Objects
        7. 22.3.7. Updating Directory Entries
        8. 22.3.8. Accessing Native ADSI Objects
        9. 22.3.9. Searching in Active Directory
          1. 22.3.9.1. SearchRoot
          2. 22.3.9.2. Filter
          3. 22.3.9.3. PropertiesToLoad
          4. 22.3.9.4. SearchScope
          5. 22.3.9.5. Search limits
      4. 22.4. Searching for User Objects
        1. 22.4.1. User Interface
        2. 22.4.2. Get the Schema Naming Context
        3. 22.4.3. Get the Property Names of the User Class
        4. 22.4.4. Search for User Objects
      5. 22.5. DSML
        1. 22.5.1. Classes in System.DirectoryServices.Protocols
        2. 22.5.2. Searching for Active Directory Objects with DSML
      6. 22.6. Summary
  8. IV. Windows Applications
    1. 23. Windows Forms
      1. 23.1. Creating a Windows Form Application
        1. 23.1.1. Class Hierarchy
      2. 23.2. Control Class
        1. 23.2.1. Size and Location
        2. 23.2.2. Appearance
        3. 23.2.3. User Interaction
        4. 23.2.4. Windows Functionality
        5. 23.2.5. Miscellaneous Functionality
      3. 23.3. Standard Controls and Components
        1. 23.3.1. Button
        2. 23.3.2. CheckBox
        3. 23.3.3. RadioButton
        4. 23.3.4. ComboBox, ListBox, and CheckedListBox
        5. 23.3.5. DateTimePicker
        6. 23.3.6. ErrorProvider
        7. 23.3.7. HelpProvider
        8. 23.3.8. ImageList
        9. 23.3.9. Label
        10. 23.3.10. ListView
        11. 23.3.11. PictureBox
        12. 23.3.12. ProgressBar
        13. 23.3.13. TextBox, RichTextBox and MaskedTextBox
        14. 23.3.14. Panel
        15. 23.3.15. FlowLayoutPanel and TableLayoutPanel
        16. 23.3.16. SplitContainer
        17. 23.3.17. TabControl and TabPages
        18. 23.3.18. ToolStrip
        19. 23.3.19. MenuStrip
        20. 23.3.20. ContextMenuStrip
        21. 23.3.21. ToolStripMenuItem
        22. 23.3.22. ToolStripManager
        23. 23.3.23. ToolStripContainer
      4. 23.4. Forms
        1. 23.4.1. Form Class
          1. 23.4.1.1. Form instantiation and destruction
          2. 23.4.1.2. Appearance
        2. 23.4.2. Multiple Document Interface (MDI)
        3. 23.4.3. Custom Controls
          1. 23.4.3.1. Control attributes
          2. 23.4.3.2. TreeView-based custom control
          3. 23.4.3.3. User control
      5. 23.5. Summary
    2. 24. Viewing .NET Data
      1. 24.1. The DataGridView Control
        1. 24.1.1. Displaying Tabular Data
        2. 24.1.2. Data Sources
          1. 24.1.2.1. Displaying data from an array
          2. 24.1.2.2. DataTable
          3. 24.1.2.3. Displaying data from a DataView
            1. 24.1.2.3.1. Filtering rows by data
            2. 24.1.2.3.2. Filtering rows on state
            3. 24.1.2.3.3. Sorting rows
          4. 24.1.2.4. Displaying data from a DataSet class
            1. 24.1.2.4.1. Displaying data in a DataViewManager
          5. 24.1.2.5. IListSource and IList interfaces
          6. 24.1.2.6. Displaying generic collections
      2. 24.2. DataGridView Class Hierarchy
      3. 24.3. Data Binding
        1. 24.3.1. Simple Binding
        2. 24.3.2. Data-Binding Objects
          1. 24.3.2.1. BindingContext
          2. 24.3.2.2. Binding
          3. 24.3.2.3. CurrencyManager and PropertyManager
      4. 24.4. Visual Studio .NET and Data Access
        1. 24.4.1. Creating a Connection
        2. 24.4.2. Selecting Data
        3. 24.4.3. Updating the Data Source
        4. 24.4.4. Building a Schema
          1. 24.4.4.1. Adding an element
          2. 24.4.4.2. Generated DataTable
          3. 24.4.4.3. Generated DataRow
          4. 24.4.4.4. Generated EventArgs
        5. 24.4.5. Other Common Requirements
          1. 24.4.5.1. Manufactured tables and rows
          2. 24.4.5.2. Using an attribute
          3. 24.4.5.3. Dispatching methods
          4. 24.4.5.4. Getting the selected row
      5. 24.5. Summary
    3. 25. Graphics with GDI+
      1. 25.1. Understanding Drawing Principles
        1. 25.1.1. GDI and GDI+
          1. 25.1.1.1. GDI+ namespaces
          2. 25.1.1.2. Device contexts and the Graphics object
        2. 25.1.2. Drawing Shapes
        3. 25.1.3. Painting Shapes Using OnPaint()
        4. 25.1.4. Using the Clipping Region
      2. 25.2. Measuring Coordinates and Areas
        1. 25.2.1. Point and PointF
        2. 25.2.2. Size and SizeF
        3. 25.2.3. Rectangle and RectangleF
        4. 25.2.4. Region
      3. 25.3. A Note about Debugging
      4. 25.4. Drawing Scrollable Windows
      5. 25.5. World, Page, and Device Coordinates
      6. 25.6. Colors
        1. 25.6.1. Red-Green-Blue (RGB) Values
        2. 25.6.2. The Named Colors
        3. 25.6.3. Graphics Display Modes and the Safety Palette
        4. 25.6.4. The Safety Palette
      7. 25.7. Pens and Brushes
        1. 25.7.1. Brushes
        2. 25.7.2. Pens
      8. 25.8. Drawing Shapes and Lines
      9. 25.9. Displaying Images
      10. 25.10. Issues When Manipulating Images
      11. 25.11. Drawing Text
      12. 25.12. Simple Text Example
      13. 25.13. Fonts and Font Families
      14. 25.14. Example: Enumerating Font Families
      15. 25.15. Editing a Text Document: The CapsEditor Sample
        1. 25.15.1. The Invalidate() Method
        2. 25.15.2. Calculating Item Sizes and Document Size
        3. 25.15.3. OnPaint()
        4. 25.15.4. Coordinate Transforms
        5. 25.15.5. Responding to User Input
      16. 25.16. Printing
        1. 25.16.1. Implementing Print and Print Preview
      17. 25.17. Summary
  9. V. Web Applications
    1. 26. ASP.NET Pages
      1. 26.1. ASP.NET Introduction
        1. 26.1.1. State Management in ASP.NET
      2. 26.2. ASP.NET Web Forms
        1. 26.2.1. The ASP.NET Code Model
        2. 26.2.2. ASP.NET Server Controls
          1. 26.2.2.1. The control palette
            1. 26.2.2.1.1. Crystal Reports Web server controls
            2. 26.2.2.1.2. Standard Web server controls
            3. 26.2.2.1.3. Data Web server controls
            4. 26.2.2.1.4. Validation Web server controls
            5. 26.2.2.1.5. Navigation and Login Web server controls
            6. 26.2.2.1.6. WebParts Web server controls
          2. 26.2.2.2. Server control example
      3. 26.3. ADO.NET and Data Binding
        1. 26.3.1. Updating the Event-Booking Application
          1. 26.3.1.1. The database
            1. 26.3.1.1.1. Attendees
            2. 26.3.1.1.2. Rooms
            3. 26.3.1.1.3. Events
          2. 26.3.1.2. Binding to the database
          3. 26.3.1.3. Customizing the calendar control
          4. 26.3.1.4. Adding events to the database
        2. 26.3.2. More on Data Binding
          1. 26.3.2.1. Data display with templates
          2. 26.3.2.2. Using templates
      4. 26.4. Application Configuration
      5. 26.5. Summary
    2. 27. ASP.NET Development
      1. 27.1. Custom Controls
        1. 27.1.1. User Controls
          1. 27.1.1.1. A simple user control
        2. 27.1.2. User Controls in PCSDemoSite
        3. 27.1.3. Custom Controls
          1. 27.1.3.1. Custom control sample
      2. 27.2. Master Pages
        1. 27.2.1. Master Pages in PCSDemoSite
      3. 27.3. Site Navigation
        1. 27.3.1. Navigation in PCSDemoSite
      4. 27.4. Security
        1. 27.4.1. Adding Forms Authentication using the Security Wizard
        2. 27.4.2. Implementing a Login System
        3. 27.4.3. Login Web Server Controls
        4. 27.4.4. Securing Directories
        5. 27.4.5. Security in PCSDemoSite
      5. 27.5. Themes
        1. 27.5.1. Applying Themes to Pages
        2. 27.5.2. Defining Themes
        3. 27.5.3. Themes in PCSDemoSite
      6. 27.6. Summary
  10. VI. Communication
    1. 28. Web Services
      1. 28.1. SOAP
      2. 28.2. WSDL
      3. 28.3. Web Services
        1. 28.3.1. Exposing Web Services
          1. 28.3.1.1. Types available for Web services
        2. 28.3.2. Consuming Web Services
      4. 28.4. Extending the Event-Booking Example
        1. 28.4.1. The Event-Booking Web Service
        2. 28.4.2. The Event-Booking Client
      5. 28.5. Exchanging Data Using SOAP Headers
      6. 28.6. Summary
    2. 29. .NET Remoting
      1. 29.1. What Is .NET Remoting?
        1. 29.1.1. Application Types and Protocols
        2. 29.1.2. CLR Object Remoting
      2. 29.2. .NET Remoting Overview
      3. 29.3. Contexts
        1. 29.3.1. Activation
        2. 29.3.2. Attributes and Properties
        3. 29.3.3. Communication between Contexts
      4. 29.4. Remote Objects, Clients, and Servers
        1. 29.4.1. Remote Objects
        2. 29.4.2. A Simple Server
        3. 29.4.3. A Simple Client
      5. 29.5. .NET Remoting Architecture
        1. 29.5.1. Channels
          1. 29.5.1.1. Setting channel properties
          2. 29.5.1.2. Pluggability of a channel
        2. 29.5.2. Formatters
        3. 29.5.3. ChannelServices and RemotingConfiguration
          1. 29.5.3.1. Server for well-known objects
          2. 29.5.3.2. Server for client-activated objects
        4. 29.5.4. Object Activation
          1. 29.5.4.1. Application URL
          2. 29.5.4.2. Activating well-known objects
          3. 29.5.4.3. Activating client-activated objects
          4. 29.5.4.4. Proxy objects
            1. 29.5.4.4.1. Pluggability of a proxy
          5. 29.5.4.5. Messages
        5. 29.5.5. Message Sinks
          1. 29.5.5.1. Envoy sink
          2. 29.5.5.2. Server context sink
          3. 29.5.5.3. Object sink
        6. 29.5.6. Passing Objects in Remote Methods
          1. 29.5.6.1. Security and serialized objects
          2. 29.5.6.2. Directional attributes
        7. 29.5.7. Lifetime Management
          1. 29.5.7.1. Lease renewals
          2. 29.5.7.2. Leasing configuration values
          3. 29.5.7.3. Classes used for lifetime management
          4. 29.5.7.4. Getting lease information example
          5. 29.5.7.5. Changing default lease configurations
      6. 29.6. Miscellaneous .NET Remoting Features
        1. 29.6.1. Configuration Files
          1. 29.6.1.1. Predefined channels
          2. 29.6.1.2. Server configuration for well-known objects
          3. 29.6.1.3. Client configuration for well-known objects
          4. 29.6.1.4. Server configuration for client-activated objects
          5. 29.6.1.5. Client configuration for client-activated objects
          6. 29.6.1.6. Server code using configuration files
          7. 29.6.1.7. Client code using configuration files
          8. 29.6.1.8. Delayed loading of client channels
          9. 29.6.1.9. Debugging Configuration
          10. 29.6.1.10. Lifetime services in configuration files
          11. 29.6.1.11. Formatter providers
          12. 29.6.1.12. .NET Framework Configuration tool
        2. 29.6.2. Hosting Servers in ASP.NET
        3. 29.6.3. Classes, Interfaces, and Soapsuds
          1. 29.6.3.1. Interfaces
          2. 29.6.3.2. Soapsuds
        4. 29.6.4. Asynchronous Remoting
          1. 29.6.4.1. Using delegates with .NET Remoting
          2. 29.6.4.2. OneWay attribute
        5. 29.6.5. Security with .NET Remoting
        6. 29.6.6. Remoting and Events
          1. 29.6.6.1. Remote object
          2. 29.6.6.2. Event arguments
          3. 29.6.6.3. Server
            1. 29.6.6.3.1. Server configuration file
          4. 29.6.6.4. Event sink
          5. 29.6.6.5. Client
            1. 29.6.6.5.1. Client configuration file
          6. 29.6.6.6. Running programs
        7. 29.6.7. Call Contexts
      7. 29.7. Summary
    3. 30. Enterprise Services
      1. 30.1. Overview
        1. 30.1.1. History
        2. 30.1.2. Where to Use Enterprise Services
        3. 30.1.3. Contexts
        4. 30.1.4. Automatic Transactions
        5. 30.1.5. Distributed Transactions
        6. 30.1.6. Object Pooling
        7. 30.1.7. Role-based Security
        8. 30.1.8. Queued Components
        9. 30.1.9. Loosely Coupled Events
        10. 30.1.10. Services without Components
      2. 30.2. Creating a Simple COM+ Application
        1. 30.2.1. Class ServicedComponent
        2. 30.2.2. Sign the Assembly
        3. 30.2.3. Assembly Attributes
        4. 30.2.4. Creating the Component
      3. 30.3. Deployment
        1. 30.3.1. Automatic Deployment
        2. 30.3.2. Manual Deployment
        3. 30.3.3. Creating an Installer Package
      4. 30.4. Component Services Explorer
      5. 30.5. Client Application
      6. 30.6. Transactions
        1. 30.6.1. ACID Properties
        2. 30.6.2. Transaction Attributes
        3. 30.6.3. Transaction Results
      7. 30.7. Sample Application
        1. 30.7.1. Entity Classes
        2. 30.7.2. The OrderControl Component
        3. 30.7.3. The OrderData Component
        4. 30.7.4. The OrderLineData Component
        5. 30.7.5. Client Application
      8. 30.8. Services without Components
      9. 30.9. Summary
    4. 31. Message Queuing
      1. 31.1. Overview
        1. 31.1.1. When to Use Message Queuing
        2. 31.1.2. Message Queuing Features
      2. 31.2. Message Queuing Products
      3. 31.3. Message Queuing Architecture
        1. 31.3.1. Messages
        2. 31.3.2. Message Queue
      4. 31.4. Message Queuing Administrative Tools
        1. 31.4.1. Creating Message Queues
        2. 31.4.2. Message Queue Properties
      5. 31.5. Programming Message Queuing
        1. 31.5.1. Creating a Message Queue
        2. 31.5.2. Finding a Queue
        3. 31.5.3. Opening Known Queues
          1. 31.5.3.1. Path name
          2. 31.5.3.2. Format name
        4. 31.5.4. Sending a Message
          1. 31.5.4.1. Message formatter
          2. 31.5.4.2. Sending complex messages
        5. 31.5.5. Receiving Messages
          1. 31.5.5.1. Enumerating messages
          2. 31.5.5.2. Asynchronous read
      6. 31.6. Course Order Application
        1. 31.6.1. Course Order Class Library
        2. 31.6.2. Course Order Message Sender
        3. 31.6.3. Sending Priority and Recoverable Messages
        4. 31.6.4. Course Order Message Receiver
      7. 31.7. Receiving Results
        1. 31.7.1. Acknowledgement Queues
        2. 31.7.2. Response Queues
      8. 31.8. Transactional Queues
      9. 31.9. Message Queue Installation
      10. 31.10. Summary
    5. 32. Future of Distributed Programming
      1. 32.1. Problems Today
      2. 32.2. Web Services
        1. 32.2.1. Security
        2. 32.2.2. Reliability
        3. 32.2.3. Transactions
        4. 32.2.4. Performance
      3. 32.3. WCF Overview
      4. 32.4. Programming with WCF
        1. 32.4.1. Contracts
          1. 32.4.1.1. Service Contract
          2. 32.4.1.2. Data Contract
          3. 32.4.1.3. Message Contract
        2. 32.4.2. Service Implementation
        3. 32.4.3. Binding
        4. 32.4.4. Hosting
        5. 32.4.5. Clients
      5. 32.5. Preparing for WCF
        1. 32.5.1. .NET Remoting
        2. 32.5.2. ASP.NET Web Services
        3. 32.5.3. Enterprise Services
        4. 32.5.4. Message Queuing
      6. 32.6. Summary
  11. VII. Interop
    1. 33. COM Interoperability
      1. 33.1. .NET and COM
        1. 33.1.1. Metadata
        2. 33.1.2. Freeing Memory
        3. 33.1.3. Interfaces
          1. 33.1.3.1. Custom interfaces
          2. 33.1.3.2. Dispatch interfaces
          3. 33.1.3.3. Dual interfaces
          4. 33.1.3.4. Casting and QueryInterface
        4. 33.1.4. Method Binding
        5. 33.1.5. Data Types
        6. 33.1.6. Registration
        7. 33.1.7. Threading
          1. 33.1.7.1. Single-threaded apartment
          2. 33.1.7.2. Multi-threaded apartment
        8. 33.1.8. Error Handling
        9. 33.1.9. Event Handling
      2. 33.2. Marshaling
      3. 33.3. Using a COM Component from a .NET Client
        1. 33.3.1. Creating a COM Component
        2. 33.3.2. Creating a Runtime Callable Wrapper
          1. 33.3.2.1. Primary interop assemblies
        3. 33.3.3. Threading Issues
        4. 33.3.4. Adding Connection Points
        5. 33.3.5. Using ActiveX Controls in Windows Forms
          1. 33.3.5.1. ActiveX Control Importer
          2. 33.3.5.2. Creating a Windows Forms application
        6. 33.3.6. Using COM Objects from within ASP.NET
      4. 33.4. Using a .NET Component from a COM Client
        1. 33.4.1. COM Callable Wrapper
        2. 33.4.2. Creating a .NET Component
        3. 33.4.3. Creating a Type Library
        4. 33.4.4. COM Interop Attributes
        5. 33.4.5. COM Registration
        6. 33.4.6. Creating a COM Client
        7. 33.4.7. Adding Connection Points
        8. 33.4.8. Creating a Client with a Sink Object
        9. 33.4.9. Running Windows Forms Controls in Internet Explorer
      5. 33.5. Summary
  12. VIII. Windows Base Services
    1. 34. Manipulating Files and the Registry
      1. 34.1. Managing the File System
        1. 34.1.1. .NET Classes That Represent Files and Folders
        2. 34.1.2. The Path Class
        3. 34.1.3. Example: A File Browser
      2. 34.2. Moving, Copying, and Deleting Files
        1. 34.2.1. Example: FilePropertiesAndMovement
        2. 34.2.2. Looking at the Code for FilePropertiesAndMovement
      3. 34.3. Reading and Writing to Files
        1. 34.3.1. Reading a File
        2. 34.3.2. Writing to a File
        3. 34.3.3. Streams
        4. 34.3.4. Buffered Streams
        5. 34.3.5. Reading and Writing to Binary Files using FileStream
          1. 34.3.5.1. The FileStream class
          2. 34.3.5.2. Example: BinaryFileReader
        6. 34.3.6. Reading and Writing to Text Files
          1. 34.3.6.1. The StreamReader class
          2. 34.3.6.2. The StreamWriter class
          3. 34.3.6.3. Example: ReadWriteText
      4. 34.4. Reading Drive Information
      5. 34.5. File Security
        1. 34.5.1. Reading ACLs from a File
        2. 34.5.2. Reading ACLs from a Directory
        3. 34.5.3. Adding and Removing ACLs from a File
      6. 34.6. Reading and Writing to the Registry
        1. 34.6.1. The Registry
        2. 34.6.2. The .NET Registry Classes
        3. 34.6.3. Example: SelfPlacingWindow
      7. 34.7. Summary
    2. 35. Accessing the Internet
      1. 35.1. The WebClient Class
        1. 35.1.1. Downloading Files
        2. 35.1.2. Basic Web Client Example
        3. 35.1.3. Uploading Files
      2. 35.2. WebRequest and WebResponse Classes
        1. 35.2.1. Other WebRequest and WebResponse Features
          1. 35.2.1.1. HTTP header information
          2. 35.2.1.2. Authentication
          3. 35.2.1.3. Asynchronous page requests
      3. 35.3. Displaying Output as an HTML Page
        1. 35.3.1. Allowing Simple Web Browsing from Your Applications
        2. 35.3.2. Launching Internet Explorer Instances
        3. 35.3.3. Giving Your Application More IE Type Features
        4. 35.3.4. Showing Documents using the WebBrowser Control
        5. 35.3.5. Printing using the WebBrowser Control
        6. 35.3.6. Displaying the Code of a Requested Page
        7. 35.3.7. The Web Request and Web Response Hierarchy
      4. 35.4. Utility Classes
        1. 35.4.1. URIs
        2. 35.4.2. IP Addresses and DNS Names
          1. 35.4.2.1. .NET classes for IP addresses
            1. 35.4.2.1.1. IPAddress
            2. 35.4.2.1.2. IPHostEntry
            3. 35.4.2.1.3. Dns
          2. 35.4.2.2. The DnsLookup example
      5. 35.5. Lower-Level Protocols
        1. 35.5.1. Lower-Level Classes
          1. 35.5.1.1. Using the TCP classes
          2. 35.5.1.2. The TcpSend and TcpReceive examples
          3. 35.5.1.3. TCP versus UDP
          4. 35.5.1.4. The UDP class
          5. 35.5.1.5. The Socket class
      6. 35.6. Summary
    3. 36. Windows Services
      1. 36.1. What Is a Windows Service?
      2. 36.2. Windows Services Architecture
        1. 36.2.1. Service Program
          1. 36.2.1.1. Service Control Manager
          2. 36.2.1.2. Main function, service-main, and handlers
        2. 36.2.2. Service Control Program
        3. 36.2.3. Service Configuration Program
      3. 36.3. System.ServiceProcess Namespace
      4. 36.4. Creating a Windows Service
        1. 36.4.1. A Class Library Using Sockets
        2. 36.4.2. TcpClient Example
        3. 36.4.3. Windows Service Project
          1. 36.4.3.1. The ServiceBase class
          2. 36.4.3.2. Main function
          3. 36.4.3.3. Service start
          4. 36.4.3.4. Handler methods
        4. 36.4.4. Threading and Services
        5. 36.4.5. Service Installation
        6. 36.4.6. Installation Program
          1. 36.4.6.1. The Installer class
          2. 36.4.6.2. The ServiceProcessInstaller and ServiceInstaller classes
          3. 36.4.6.3. The ServiceInstallerDialog class
          4. 36.4.6.4. installutil
          5. 36.4.6.5. Client
      5. 36.5. Monitoring and Controlling the Service
        1. 36.5.1. MMC Computer Management
        2. 36.5.2. net.exe
        3. 36.5.3. sc.exe
        4. 36.5.4. Visual Studio Server Explorer
        5. 36.5.5. ServiceController Class
          1. 36.5.5.1. Monitoring the service
          2. 36.5.5.2. Controlling the service
      6. 36.6. Troubleshooting
        1. 36.6.1. Interactive Services
        2. 36.6.2. Event Logging
          1. 36.6.2.1. Event Logging architecture
          2. 36.6.2.2. Event Logging classes
          3. 36.6.2.3. Adding event logging
          4. 36.6.2.4. Adding event logging to other application types
          5. 36.6.2.5. Adding event logging to the QuoteServer
          6. 36.6.2.6. Trace
          7. 36.6.2.7. Creating an event log listener
        3. 36.6.3. Performance Monitoring
          1. 36.6.3.1. Performance monitoring classes
          2. 36.6.3.2. Performance Counter Builder
          3. 36.6.3.3. Adding PerformanceCounter components
          4. 36.6.3.4. perfmon.exe
      7. 36.7. Power Events
      8. 36.8. Summary
  13. IX. Appendices
    1. A. Principles of Object-Oriented Programming
      1. A.1. A Note for Visual Basic 6 Programmers
      2. A.2. What Is an Object?
      3. A.3. Objects in Programming
        1. A.3.1. Class Members
        2. A.3.2. Defining a Class
        3. A.3.3. Access Modifiers
        4. A.3.4. Instantiating and Using Objects
        5. A.3.5. Using Static Members
          1. A.3.5.1. Creating static fields
          2. A.3.5.2. Creating static methods
          3. A.3.5.3. Accessing static members
          4. A.3.5.4. How instance and static methods are implemented in memory
        6. A.3.6. A Note About Reference Types
        7. A.3.7. Overloading Methods
          1. A.3.7.1. When to Use Overloading
            1. A.3.7.1.1. Optional parameters
            2. A.3.7.1.2. Different input types
            3. A.3.7.1.3. Different output types
        8. A.3.8. Properties
        9. A.3.9. Data Encapsulation
      4. A.4. Introducing Inheritance
        1. A.4.1. Using Inheritance in C#
        2. A.4.2. Adding Inheritance
        3. A.4.3. Class Hierarchies and Class Design
          1. A.4.3.1. The object class
          2. A.4.3.2. Single and multiple inheritance
        4. A.4.4. Polymorphism and Virtual Members
        5. A.4.5. Method Hiding
        6. A.4.6. Abstract Functions and Base Classes
        7. A.4.7. Defining an Abstract Class
        8. A.4.8. Sealed Classes and Methods
      5. A.5. Interfaces
      6. A.6. Construction and Disposal
        1. A.6.1. Creating Constructors
          1. A.6.1.1. Passing parameters to constructors
          2. A.6.1.2. More uses of constructors
      7. A.7. Summary
    2. B. C# for Visual Basic 6 Developers
      1. B.1. Differences Between C# and Visual Basic
        1. B.1.1. Classes
        2. B.1.2. Compilation
        3. B.1.3. The .NET Base Classes
        4. B.1.4. Conventions
        5. B.1.5. Example: The Square Root Form
        6. B.1.6. SquareRoot Visual Basic Version
        7. B.1.7. SquareRoot C# Version
        8. B.1.8. Basic Syntax
          1. B.1.8.1. C# requires all variables to be declared
          2. B.1.8.2. Comments
          3. B.1.8.3. Statement separation and grouping
          4. B.1.8.4. Capitalization
        9. B.1.9. Methods
        10. B.1.10. Variables
          1. B.1.10.1. Declarations
            1. B.1.10.1.1. No suffixes in C#
            2. B.1.10.1.2. No default values for local variables
          2. B.1.10.2. Assigning values to variables
        11. B.1.11. Classes
        12. B.1.12. If Statements
          1. B.1.12.1. Calculating square roots: Another class method
          2. B.1.12.2. Strings
        13. B.1.13. Extra Code in C#
        14. B.1.14. What Happens When You Run a Program
        15. B.1.15. The C# Code for the Rest of the Program
          1. B.1.15.1. Namespaces
          2. B.1.15.2. The using directive
          3. B.1.15.3. The class definition: Inheritance
        16. B.1.16. Program Entry Point
        17. B.1.17. Instantiating Classes
          1. B.1.17.1. C# classes
          2. B.1.17.2. Entering the message loop
        18. B.1.18. The SquareRootForm Class
          1. B.1.18.1.
            1. B.1.18.1.1. Arithmetic assignment operators
      2. B.2. Example: Employees and Managers
        1. B.2.1. The Visual Basic Employee Class Module
          1. B.2.1.1. The C# Employee class
          2. B.2.1.2. The Employee constructor
          3. B.2.1.3. Properties of Employee
          4. B.2.1.4. Methods of Employee
        2. B.2.2. Static Members
        3. B.2.3. Inheritance
        4. B.2.4. Inheriting from the Employee Class
        5. B.2.5. The Manager Class
        6. B.2.6. Method Overrides
        7. B.2.7. The Manager Constructors
        8. B.2.8. Method Overloading
        9. B.2.9. Using the Employee and Manager Classes
        10. B.2.10. References to Derived Classes
      3. B.3. Arrays of Objects
      4. B.4. The for Loop
      5. B.5. Other C# Features
        1. B.5.1. Data Types
        2. B.5.2. Value and Reference Types
        3. B.5.3. Operators
        4. B.5.4. The ternary operator
      6. B.6. Summary
    3. C. C# for Java Developers
      1. C.1. Starting Out
        1. C.1.1. Compiling and Running C# Code
        2. C.1.2. Namespaces
      2. C.2. Declaring Variables
      3. C.3. Variable Naming Conventions
      4. C.4. Data Types
        1. C.4.1. Value Types
          1. C.4.1.1. Simple types
            1. C.4.1.1.1. Integer values
            2. C.4.1.1.2. Character values
            3. C.4.1.1.3. Boolean values
            4. C.4.1.1.4. Decimal values
            5. C.4.1.1.5. Floating-point values
          2. C.4.1.2. Enumeration types
          3. C.4.1.3. Structures
            1. C.4.1.3.1. Structs and attributes
        2. C.4.2. Reference Types
        3. C.4.3. Arrays and Collections
        4. C.4.4. Type Conversion and Casting
      5. C.5. Operators
      6. C.6. Flow Control and Iteration
      7. C.7. Classes
        1. C.7.1. Access Modifiers
        2. C.7.2. Class Members
          1. C.7.2.1. Passing as reference to methods
          2. C.7.2.2. Properties
          3. C.7.2.3. Destructors
        3. C.7.3. Class Inheritance
          1. C.7.3.1. Abstract classes
          2. C.7.3.2. Preventing inheritance
          3. C.7.3.3. Using base class members and base constructors
          4. C.7.3.4. Method overriding and hiding
      8. C.8. Input and Output
      9. C.9. Summary
    4. D. C# for C++ Developers
      1. D.1. Conventions for This Appendix
      2. D.2. Terminology
      3. D.3. A Comparison of C# and C++
        1. D.3.1. Differences
        2. D.3.2. Similarities
        3. D.3.3. New Features
        4. D.3.4. New Base Class Features
      4. D.4. The Hello World Example
        1. D.4.1. #include Statements
        2. D.4.2. Namespaces
        3. D.4.3. Entry Point: Main() versus main()
        4. D.4.4. Displaying the Message
      5. D.5. Topic-by-Topic Comparison
        1. D.5.1. Program Architecture
          1. D.5.1.1. Program objects
          2. D.5.1.2. File structure
          3. D.5.1.3. Program entry point
        2. D.5.2. Language Syntax
          1. D.5.2.1. Forward declarations
          2. D.5.2.2. No separation of definition and declaration
        3. D.5.3. Program Flow
          1. D.5.3.1. if...else
          2. D.5.3.2. while and do while
          3. D.5.3.3. switch
          4. D.5.3.4. foreach
        4. D.5.4. Variables
          1. D.5.4.1. Basic data types
          2. D.5.4.2. Basic data types as objects
          3. D.5.4.3. Casting between the basic data types
          4. D.5.4.4. Overflow checking
          5. D.5.4.5. Strings
          6. D.5.4.6. Escape sequences
          7. D.5.4.7. Value types and reference types
          8. D.5.4.8. Initialization of variables
          9. D.5.4.9. Boxing
        5. D.5.5. Memory Management
          1. D.5.5.1. The new operator
          2. D.5.5.2. The delete operator
        6. D.5.6. Methods
          1. D.5.6.1. Method parameters
          2. D.5.6.2. Method overloads
        7. D.5.7. Properties
        8. D.5.8. Operators
          1. D.5.8.1. Assignment operator (=)
          2. D.5.8.2. this
          3. D.5.8.3. new
        9. D.5.9. Classes and Structs
        10. D.5.10. Classes
          1. D.5.10.1. Definition of a class
          2. D.5.10.2. Initialization of member fields
            1. D.5.10.2.1. Instance members
            2. D.5.10.2.2. Static fields
          3. D.5.10.3. Constructors
          4. D.5.10.4. Static constructors
          5. D.5.10.5. Default constructors
          6. D.5.10.6. Constructor initialization lists
          7. D.5.10.7. Destructors
          8. D.5.10.8. Inheritance
          9. D.5.10.9. Virtual and non-virtual functions
        11. D.5.11. Structs
        12. D.5.12. Constants
          1. D.5.12.1. Constants that are associated with a class (static constants)
          2. D.5.12.2. Instance constants
        13. D.5.13. Operator Overloading
          1. D.5.13.1. Indexers
          2. D.5.13.2. User-defined casts
        14. D.5.14. Arrays
          1. D.5.14.1. One-dimensional arrays
          2. D.5.14.2. Multidimensional arrays
          3. D.5.14.3. Bounds checking
          4. D.5.14.4. Resizing arrays
        15. D.5.15. Enumerations
        16. D.5.16. Exceptions
        17. D.5.17. Pointers and Unsafe Code
          1. D.5.17.1. Fixing data on the heap
          2. D.5.17.2. Declaring arrays on the stack
        18. D.5.18. Interfaces
        19. D.5.19. Delegates
        20. D.5.20. Events
        21. D.5.21. Attributes
        22. D.5.22. Templates and Generics
        23. D.5.23. Preprocessor Directives
      6. D.6. Summary