You are previewing C# Programmer’s Cookbook.
O'Reilly logo
C# Programmer’s Cookbook

Book Description

Featuring a concise problem/solution format, the C# PROGRAMMER’S COOKBOOK provides at-a-glance reference to hundreds of C# programming scenarios—with practical examples, code snippets, best practices, and shortcuts to get the job done.

Table of Contents

  1. Copyright
    1. Dedication
  2. Introduction
    1. Code Samples
    2. System Requirements
    3. Other Books
    4. Microsoft Press Support
  3. 1. Application Development
    1. 1.1. Create a Console Application
      1. Problem
      2. Solution
      3. Discussion
    2. 1.2. Create a Windows-Based Application
      1. Problem
      2. Solution
      3. Discussion
    3. 1.3. Create and Use a Code Module
      1. Problem
      2. Solution
      3. Discussion
    4. 1.4. Create and Use a Code Library
      1. Problem
      2. Solution
      3. Discussion
    5. 1.5. Access Command-Line Arguments
      1. Problem
      2. Solution
      3. Discussion
    6. 1.6. Selectively Include Code at Build Time
      1. Problem
      2. Solution
      3. Discussion
    7. 1.7. Access a Program Element That Has the Same Name as a Keyword
      1. Problem
      2. Solution
      3. Discussion
    8. 1.8. Create and Manage Strong-Named Key Pairs
      1. Problem
      2. Solution
      3. Discussion
    9. 1.9. Give an Assembly a Strong Name
      1. Problem
      2. Solution
      3. Discussion
    10. 1.10. Verify That a Strong-Named Assembly Has Not Been Modified
      1. Problem
      2. Solution
      3. Discussion
    11. 1.11. Delay Sign an Assembly
      1. Problem
      2. Solution
      3. Discussion
    12. 1.12. Sign an Assembly with an Authenticode Digital Signature
      1. Problem
      2. Solution
      3. Discussion
    13. 1.13. Create and Trust a Test Software Publisher Certificate
      1. Problem
      2. Solution
      3. Discussion
    14. 1.14. Manage the Global Assembly Cache
      1. Problem
      2. Solution
      3. Discussion
    15. 1.15. Prevent People from Decompiling Your Code
      1. Problem
      2. Solution
      3. Discussion
  4. 2. Working with Data
    1. 2.1. Manipulate the Contents of a String Efficiently
      1. Problem
      2. Solution
      3. Discussion
    2. 2.2. Encode a String Using Alternate Character Encoding
      1. Problem
      2. Solution
      3. Discussion
    3. 2.3. Convert Basic Value Types to Byte Arrays
      1. Problem
      2. Solution
      3. Discussion
    4. 2.4. Encode Binary Data as Text
      1. Problem
      2. Solution
      3. Discussion
    5. 2.5. Validate Input Using Regular Expressions
      1. Problem
      2. Solution
      3. Discussion
    6. 2.6. Use Compiled Regular Expressions
      1. Problem
      2. Solution
      3. Discussion
    7. 2.7. Create Dates and Times from Strings
      1. Problem
      2. Solution
      3. Discussion
    8. 2.8. Add, Subtract, and Compare Dates and Times
      1. Problem
      2. Solution
      3. Discussion
    9. 2.9. Sort an Array or an ArrayList
      1. Problem
      2. Solution
      3. Discussion
    10. 2.10. Copy a Collection to an Array
      1. Problem
      2. Solution
      3. Discussion
    11. 2.11. Create a Strongly Typed Collection
      1. Problem
      2. Solution
      3. Discussion
    12. 2.12. Store a Serializable Object to a File
      1. Problem
      2. Solution
      3. Discussion
  5. 3. Application Domains, Reflection, and Metadata
    1. 3.1. Create an Application Domain
      1. Problem
      2. Solution
      3. Discussion
    2. 3.2. Pass Objects Across Application Domain Boundaries
      1. Problem
      2. Solution
      3. Discussion
    3. 3.3. Avoid Loading Unnecessary Assemblies into Application Domains
      1. Problem
      2. Solution
      3. Discussion
    4. 3.4. Create a Type That Can’t Cross Application Domain Boundaries
      1. Problem
      2. Solution
      3. Discussion
    5. 3.5. Load an Assembly into the Current Application Domain
      1. Problem
      2. Solution
      3. Discussion
    6. 3.6. Execute an Assembly in a Different Application Domain
      1. Problem
      2. Solution
      3. Discussion
    7. 3.7. Instantiate a Type in a Different Application Domain
      1. Problem
      2. Solution
      3. Discussion
    8. 3.8. Pass Data Between Application Domains
      1. Problem
      2. Solution
      3. Discussion
    9. 3.9. Unload Assemblies and Application Domains
      1. Problem
      2. Solution
      3. Discussion
    10. 3.10. Retrieve Type Information
      1. Problem
      2. Solution
      3. Discussion
    11. 3.11. Test an Object’s Type
      1. Problem
      2. Solution
      3. Discussion
    12. 3.12. Instantiate an Object Using Reflection
      1. Problem
      2. Solution
      3. Discussion
    13. 3.13. Create a Custom Attribute
      1. Problem
      2. Solution
      3. Discussion
    14. 3.14. Inspect the Attributes of a Program Element Using Reflection
      1. Problem
      2. Solution
      3. Discussion
  6. 4. Threads, Processes, and Synchronization
    1. 4.1. Execute a Method Using the Thread Pool
      1. Problem
      2. Solution
      3. Discussion
    2. 4.2. Execute a Method Asynchronously
      1. Problem
      2. Solution
      3. Discussion
    3. 4.3. Execute a Method Using a Timer
      1. Problem
      2. Solution
      3. Discussion
    4. 4.4. Execute a Method by Signaling a WaitHandle Object
      1. Problem
      2. Solution
      3. Discussion
    5. 4.5. Execute a Method Using a New Thread
      1. Problem
      2. Solution
      3. Discussion
    6. 4.6. Control the Execution of a Thread
      1. Problem
      2. Solution
      3. Discussion
    7. 4.7. Know When a Thread Finishes
      1. Problem
      2. Solution
      3. Discussion
    8. 4.8. Synchronize the Execution of Multiple Threads
      1. Problem
      2. Solution
      3. Discussion
    9. 4.9. Create a Thread-Safe Collection Instance
      1. Problem
      2. Solution
      3. Discussion
    10. 4.10. Start a New Process
      1. Problem
      2. Solution
      3. Discussion
    11. 4.11. Terminate a Process
      1. Problem
      2. Solution
      3. Discussion
    12. 4.12. Ensure That Only One Instance of an Application Can Execute Concurrently
      1. Problem
      2. Solution
      3. Discussion
  7. 5. XML Processing
    1. 5.1. Show the Structure of an XML Document in a TreeView
      1. Problem
      2. Solution
      3. Discussion
    2. 5.2. Insert Nodes in an XML Document
      1. Problem
      2. Solution
      3. Discussion
    3. 5.3. Quickly Append Nodes in an XML Document
      1. Problem
      2. Solution
      3. Discussion
    4. 5.4. Find Specific Elements by Name
      1. Problem
      2. Solution
      3. Discussion
    5. 5.5. Get XML Nodes in a Specific XML Namespace
      1. Problem
      2. Solution
      3. Discussion
    6. 5.6. Find Elements with an XPath Search
      1. Problem
      2. Solution
      3. Discussion
    7. 5.7. Read and Write XML Without Loading an Entire Document into Memory
      1. Problem
      2. Solution
      3. Discussion
    8. 5.8. Validate an XML Document Against a Schema
      1. Problem
      2. Solution
      3. Discussion
    9. 5.9. Use XML Serialization with Custom Objects
      1. Problem
      2. Solution
      3. Discussion
    10. 5.10. Create a Schema for a .NET Class
      1. Problem
      2. Solution
      3. Discussion
    11. 5.11. Generate a Class from a Schema
      1. Problem
      2. Solution
      3. Discussion
    12. 5.12. Perform an XSL Transform
      1. Problem
      2. Solution
      3. Discussion
  8. 6. Windows Forms
    1. 6.1. Add a Control Programmatically
      1. Problem
      2. Solution
      3. Discussion
    2. 6.2. Link Data to a Control
      1. Problem
      2. Solution
      3. Discussion
    3. 6.3. Process All the Controls on a Form
      1. Problem
      2. Solution
      3. Discussion
    4. 6.4. Track the Visible Forms in an Application
      1. Problem
      2. Solution
      3. Discussion
    5. 6.5. Find All MDI Child Forms
      1. Problem
      2. Solution
      3. Discussion
    6. 6.6. Save the Size and Location of a Form
      1. Problem
      2. Solution
      3. Discussion
    7. 6.7. Force a List Box to Scroll
      1. Problem
      2. Solution
      3. Discussion
    8. 6.8. Restrict a Text Box to Numeric Input
      1. Problem
      2. Solution
      3. Discussion
    9. 6.9. Use an Autocomplete Combo Box
      1. Problem
      2. Solution
      3. Discussion
    10. 6.10. Sort a List View by Any Column
      1. Problem
      2. Solution
      3. Discussion
    11. 6.11. Link a Context Menu to a Control
      1. Problem
      2. Solution
      3. Discussion
    12. 6.12. Use Part of a Main Menu for a Context Menu
      1. Problem
      2. Solution
      3. Discussion
    13. 6.13. Make a Multilingual Form
      1. Problem
      2. Solution
      3. Discussion
    14. 6.14. Create a Form That Can’t Be Moved
      1. Problem
      2. Solution
      3. Discussion
    15. 6.15. Make a Borderless Form Movable
      1. Problem
      2. Solution
      3. Discussion
    16. 6.16. Create an Animated System Tray Icon
      1. Problem
      2. Solution
      3. Discussion
    17. 6.17. Validate an Input Control
      1. Problem
      2. Solution
      3. Discussion
    18. 6.18. Use a Drag-and-Drop Operation
      1. Problem
      2. Solution
      3. Discussion
    19. 6.19. Use Context-Sensitive Help
      1. Problem
      2. Solution
      3. Discussion
    20. 6.20. Apply Windows XP Control Styles
      1. Problem
      2. Solution
      3. Discussion
  9. 7. ASP.NET and Web Forms
    1. 7.1. Redirect the User to Another Page
      1. Problem
      2. Solution
      3. Discussion
    2. 7.2. Store Information Between Requests
      1. Problem
      2. Solution
      3. Discussion
    3. 7.3. Create Stateful Page Member Variables
      1. Problem
      2. Solution
      3. Discussion
    4. 7.4. Respond to Client-Side Events with JavaScript
      1. Problem
      2. Solution
      3. Discussion
    5. 7.5. Show a Pop-Up Window with JavaScript
      1. Problem
      2. Solution
      3. Discussion
    6. 7.6. Programmatically Set Control Focus
      1. Problem
      2. Solution
      3. Discussion
    7. 7.7. Allow the User to Upload a File
      1. Problem
      2. Solution
      3. Discussion
    8. 7.8. Use IIS Authentication
      1. Problem
      2. Solution
      3. Discussion
    9. 7.9. Use Forms Authentication
      1. Problem
      2. Solution
      3. Discussion
    10. 7.10. Perform Selective Input Validation
      1. Problem
      2. Solution
      3. Discussion
    11. 7.11. Add Controls to a Web Form Dynamically
      1. Problem
      2. Solution
      3. Discussion
    12. 7.12. Dynamically Render an Image
      1. Problem
      2. Solution
      3. Discussion
    13. 7.13. Load User Controls Programmatically
      1. Problem
      2. Solution
      3. Discussion
    14. 7.14. Use Page and Fragment Caching
      1. Problem
      2. Solution
      3. Discussion
    15. 7.15. Reuse Data with the ASP.NET Cache
      1. Problem
      2. Solution
      3. Discussion
    16. 7.16. Enable Web Site Debugging
      1. Problem
      2. Solution
      3. Discussion
    17. 7.17. Change the Permissions Given to ASP.NET Code
      1. Problem
      2. Solution
      3. Discussion
  10. 8. Graphics, Multimedia, and Printing
    1. 8.1. Find All Installed Fonts
      1. Problem
      2. Solution
      3. Discussion
    2. 8.2. Perform Hit Testing with Shapes
      1. Problem
      2. Solution
      3. Discussion
    3. 8.3. Create an Irregularly Shaped Control
      1. Problem
      2. Solution
      3. Discussion
    4. 8.4. Create a Movable Sprite
      1. Problem
      2. Solution
      3. Discussion
    5. 8.5. Create a Scrollable Image
      1. Problem
      2. Solution
      3. Discussion
    6. 8.6. Perform a Screen Capture
      1. Problem
      2. Solution
      3. Discussion
    7. 8.7. Use Double Buffering to Increase Redraw Speed
      1. Problem
      2. Solution
      3. Discussion
    8. 8.8. Show a Thumbnail for an Image
      1. Problem
      2. Solution
      3. Discussion
    9. 8.9. Play a Simple Beep
      1. Problem
      2. Solution
      3. Discussion
    10. 8.10. Play a WAV or an MP3 File
      1. Problem
      2. Solution
      3. Discussion
    11. 8.11. Show an Animation with DirectShow
      1. Problem
      2. Solution
      3. Discussion
    12. 8.12. Retrieve Information About the Installed Printers
      1. Problem
      2. Solution
      3. Discussion
    13. 8.13. Print a Simple Document
      1. Problem
      2. Solution
      3. Discussion
    14. 8.14. Print a Multipage Document
      1. Problem
      2. Solution
      3. Discussion
    15. 8.15. Print Wrapped Text
      1. Problem
      2. Solution
      3. Discussion
    16. 8.16. Show a Dynamic Print Preview
      1. Problem
      2. Solution
      3. Discussion
    17. 8.17. Manage Print Jobs
      1. Problem
      2. Solution
      3. Discussion
  11. 9. Files, Directories, and I/O
    1. 9.1. Retrieving Information About a File or Directory
      1. Problem
      2. Solution
      3. Discussion
    2. 9.2. Set File and Directory Attributes
      1. Problem
      2. Solution
      3. Discussion
    3. 9.3. Copy, Move, or Delete a File or a Directory
      1. Problem
      2. Solution
      3. Discussion
    4. 9.4. Calculate the Size of a Directory
      1. Problem
      2. Solution
      3. Discussion
    5. 9.5. Retrieve Version Information for a File
      1. Problem
      2. Solution
      3. Discussion
    6. 9.6. Show a Just-in-Time Directory Tree in the TreeView Control
      1. Problem
      2. Solution
      3. Discussion
    7. 9.7. Read and Write a Text File
      1. Problem
      2. Solution
      3. Discussion
    8. 9.8. Read and Write a Binary File
      1. Problem
      2. Solution
      3. Discussion
    9. 9.9. Read a File Asynchronously
      1. Problem
      2. Solution
      3. Discussion
    10. 9.10. Find Files That Match a Wildcard Expression
      1. Problem
      2. Solution
      3. Discussion
    11. 9.11. Test Two Files for Equality
      1. Problem
      2. Solution
      3. Discussion
    12. 9.12. Manipulate Strings Representing file names
      1. Problem
      2. Solution
      3. Discussion
    13. 9.13. Determine if a Path Is a Directory or a File
      1. Problem
      2. Solution
      3. Discussion
    14. 9.14. Work with Relative Paths
      1. Problem
      2. Solution
      3. Discussion
    15. 9.15. Create a Temporary File
      1. Problem
      2. Solution
      3. Discussion
    16. 9.16. Get the Total Free Space on a Drive
      1. Problem
      2. Solution
      3. Discussion
    17. 9.17. Show the Common File Dialogs
      1. Problem
      2. Solution
      3. Discussion
    18. 9.18. Use an Isolated Store
      1. Problem
      2. Solution
      3. Discussion
    19. 9.19. Monitor the File System for Changes
      1. Problem
      2. Solution
      3. Discussion
    20. 9.20. Access a COM Port
      1. Problem
      2. Solution
      3. Discussion
  12. 10. Database Access
    1. 10.1. Connect to a Database
      1. Problem
      2. Solution
      3. Discussion
    2. 10.2. Use Connection Pooling
      1. Problem
      2. Solution
      3. Discussion
    3. 10.3. Execute a SQL Command or Stored Procedure
      1. Problem
      2. Solution
      3. Discussion
    4. 10.4. Use Parameters in a SQL Command or Stored Procedure
      1. Problem
      2. Solution
      3. Discussion
    5. 10.5. Process the Results of a SQL Query Using a Data Reader
      1. Problem
      2. Solution
      3. Discussion
    6. 10.6. Obtain an XML Document from a SQL Server Query
      1. Problem
      2. Solution
      3. Discussion
    7. 10.7. Discover All Instances of SQL Server 2000 on Your Network
      1. Problem
      2. Solution
      3. Discussion
  13. 11. Networking and Internetworking
    1. 11.1. Download a File over HTTP
      1. Problem
      2. Solution
      3. Discussion
    2. 11.2. Download a File and Process It Using a Stream
      1. Problem
      2. Solution
      3. Discussion
    3. 11.3. Get an HTML Page from a Site That Requires Authentication
      1. Problem
      2. Solution
      3. Discussion
    4. 11.4. Display a Web Page in a Windows-Based Application
      1. Problem
      2. Solution
      3. Discussion
    5. 11.5. Get the IP Address of the Current Computer
      1. Problem
      2. Solution
      3. Discussion
    6. 11.6. Resolve a Host Name to an IP Address
      1. Problem
      2. Solution
      3. Discussion
    7. 11.7. Ping an IP Address
      1. Problem
      2. Solution
      3. Discussion
    8. 11.8. Communicate Using TCP
      1. Problem
      2. Solution
      3. Discussion
    9. 11.9. Get the Client IP Address from a Socket Connection
      1. Problem
      2. Solution
      3. Discussion
    10. 11.10. Set Socket Options
      1. Problem
      2. Solution
      3. Discussion
    11. 11.11. Create a Multithreaded TCP Server
      1. Problem
      2. Solution
      3. Discussion
    12. 11.12. Use TCP Asynchronously
      1. Problem
      2. Solution
      3. Discussion
    13. 11.13. Communicate Using UDP
      1. Problem
      2. Solution
      3. Discussion
    14. 11.14. Send E-Mail Through SMTP
      1. Problem
      2. Solution
      3. Discussion
    15. 11.15. Send and Retrieve E-Mail with MAPI
      1. Problem
      2. Solution
      3. Discussion
  14. 12. XML Web Services and Remoting
    1. 12.1. Avoid Hard-Coding the XML Web Service URL
      1. Problem
      2. Solution
      3. Discussion
    2. 12.2. Use Response Caching in an XML Web Service
      1. Problem
      2. Solution
      3. Discussion
    3. 12.3. Use Data Caching in an XML Web Service
      1. Problem
      2. Solution
      3. Discussion
    4. 12.4. Create a Transactional Web Method
      1. Problem
      2. Solution
      3. Discussion
    5. 12.5. Set Authentication Credentials for an XML Web Service
      1. Problem
      2. Solution
      3. Discussion
    6. 12.6. Call a Web Method Asynchronously
      1. Problem
      2. Solution
      3. Discussion
    7. 12.7. Make an Object Remotable
      1. Problem
      2. Solution
      3. Discussion
    8. 12.8. Register All the Remotable Classes in an Assembly
      1. Problem
      2. Solution
      3. Discussion
    9. 12.9. Host a Remote Object in IIS
      1. Problem
      2. Solution
      3. Discussion
    10. 12.10. Fire an Event Over a Remoting Channel
      1. Problem
      2. Solution
      3. Discussion
    11. 12.11. Control the Lifetime of a Remote Object
      1. Problem
      2. Solution
      3. Discussion
    12. 12.12. Control Versioning for Remote Objects
      1. Problem
      2. Solution
      3. Discussion
    13. 12.13. Create a One-Way Method with XML Web Services or Remoting
      1. Problem
      2. Solution
      3. Discussion
  15. 13. Runtime Security
    1. 13.1. Allow Partially Trusted Code to Use Your Strong-Named Assembly
      1. Problem
      2. Solution
      3. Discussion
    2. 13.2. Disable Code Access Security
      1. Problem
      2. Solution
      3. Discussion
    3. 13.3. Disable Execution Permission Checks
      1. Problem
      2. Solution
      3. Discussion
    4. 13.4. Ensure the Runtime Grants Specific Permissions to Your Assembly
      1. Problem
      2. Solution
      3. Discussion
    5. 13.5. Limit the Permissions Granted to Your Assembly
      1. Problem
      2. Solution
      3. Discussion
    6. 13.6. View the Permission Requests Made by an Assembly
      1. Problem
      2. Solution
      3. Discussion
    7. 13.7. Determine at Run Time if Your Code Has a Specific Permission
      1. Problem
      2. Solution
      3. Discussion
    8. 13.8. Restrict Who Can Extend Your Classes and Override Class Members
      1. Problem
      2. Solution
      3. Discussion
    9. 13.9. Inspect an Assembly’s Evidence
      1. Problem
      2. Solution
      3. Discussion
    10. 13.10. Manipulate Evidence as You Load an Assembly
      1. Problem
      2. Solution
      3. Discussion
    11. 13.11. Manipulate Runtime Security Using Application Domain Evidence
      1. Problem
      2. Solution
      3. Discussion
    12. 13.12. Manipulate Runtime Security Using Application Domain Security Policy
      1. Problem
      2. Solution
      3. Discussion
    13. 13.13. Determine if the Current User Is a Member of a Specific Windows Group
      1. Problem
      2. Solution
      3. Discussion
    14. 13.14. Restrict Which Users Can Execute Your Code
      1. Problem
      2. Solution
      3. Discussion
    15. 13.15. Impersonate a Windows User
      1. Problem
      2. Solution
      3. Discussion
  16. 14. Cryptography
    1. 14.1. Create a Cryptographically Random Number
      1. Problem
      2. Solution
      3. Discussion
    2. 14.2. Calculate the Hash Code of a Password
      1. Problem
      2. Solution
      3. Discussion
    3. 14.3. Calculate the Hash Code of a File
      1. Problem
      2. Solution
      3. Discussion
    4. 14.4. Verify a Hash Code
      1. Problem
      2. Solution
      3. Discussion
    5. 14.5. Ensure Data Integrity Using a Keyed Hash Code
      1. Problem
      2. Solution
      3. Discussion
    6. 14.6. Protect a File Using Symmetric Encryption
      1. Problem
      2. Solution
      3. Discussion
    7. 14.7. Derive a Symmetric Encryption Key from a Password
      1. Problem
      2. Solution
      3. Discussion
    8. 14.8. Send a Secret Securely Using Asymmetric Encryption
      1. Problem
      2. Solution
      3. Discussion
    9. 14.9. Store an Asymmetric Encryption Key Securely
      1. Problem
      2. Solution
      3. Discussion
    10. 14.10. Exchange Symmetric Session Keys Securely
      1. Problem
      2. Solution
      3. Discussion
  17. 15. Unmanaged Code Interoperability
    1. 15.1. Call a Function in an Unmanaged DLL
      1. Problem
      2. Solution
      3. Discussion
    2. 15.2. Get the Handle for a Control, a Window, or a File
      1. Problem
      2. Solution
      3. Discussion
    3. 15.3. Call an Unmanaged Function That Uses a Structure
      1. Problem
      2. Solution
      3. Discussion
    4. 15.4. Call an Unmanaged Function That Uses a Callback
      1. Problem
      2. Solution
      3. Discussion
    5. 15.5. Retrieve Unmanaged Error Information
      1. Problem
      2. Solution
      3. Discussion
    6. 15.6. Use a COM Component in a .NET Client
      1. Problem
      2. Solution
      3. Discussion
    7. 15.7. Release a COM Component Quickly
      1. Problem
      2. Solution
      3. Discussion
    8. 15.8. Use Optional Parameters
      1. Problem
      2. Solution
      3. Discussion
    9. 15.9. Use an ActiveX Control in a .NET Client
      1. Problem
      2. Solution
      3. Discussion
    10. 15.10. Expose a .NET Component Through COM
      1. Problem
      2. Solution
      3. Discussion
  18. 16. Commonly Used Interfaces and Patterns
    1. 16.1. Implement a Serializable Type
      1. Problem
      2. Solution
      3. Discussion
    2. 16.2. Implement a Cloneable Type
      1. Problem
      2. Solution
      3. Discussion
    3. 16.3. Implement a Comparable Type
      1. Problem
      2. Solution
      3. Discussion
    4. 16.4. Implement an Enumerable Type
      1. Problem
      2. Solution
      3. Discussion
    5. 16.5. Implement a Disposable Class
      1. Problem
      2. Solution
      3. Discussion
    6. 16.6. Implement a Formattable Type
      1. Problem
      2. Solution
      3. Discussion
    7. 16.7. Implement a Custom Exception Class
      1. Problem
      2. Solution
      3. Discussion
    8. 16.8. Implement a Custom Event Argument
      1. Problem
      2. Solution
      3. Discussion
    9. 16.9. Implement the Singleton Pattern
      1. Problem
      2. Solution
      3. Discussion
    10. 16.10. Implement the Observer Pattern
      1. Problem
      2. Solution
      3. Discussion
  19. 17. Windows Integration
    1. 17.1. Access Run-Time Environment Information
      1. Problem
      2. Solution
      3. Discussion
    2. 17.2. Retrieve the Value of an Environment Variable
      1. Problem
      2. Solution
      3. Discussion
    3. 17.3. Write an Event to the Windows Event Log
      1. Problem
      2. Solution
      3. Discussion
    4. 17.4. Access the Windows Registry
      1. Problem
      2. Solution
      3. Discussion
    5. 17.5. Create a Windows Service
      1. Problem
      2. Solution
      3. Discussion
    6. 17.6. Create a Windows Service Installer
      1. Problem
      2. Solution
      3. Discussion
    7. 17.7. Create a Shortcut on the Desktop or Start Menu
      1. Problem
      2. Solution
      3. Discussion
  20. Allen Jones