Visual C# 2010 Recipes: A Problem-Solution Approach

Book description

When you are facing a Visual C# 2010 problem, this book likely contains a recipe that provides you with the solution-or at least points you in the right direction. Even if you are simply looking to broaden your knowledge of the .NET Framework class library, then Visual C# 2010 Recipes is the perfect resource to assist you.

Table of contents

  1. Copyright
  2. About the Authors
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
  6. 1. Application Development
    1. 1.1. Create a Console Application from the Command Line
      1. 1.1.1. Problem
      2. 1.1.2. Solution
      3. 1.1.3. How It Works
        1. 1.1.3.1. The Code
        2. 1.1.3.2. Usage
    2. 1.2. Create a Windows-Based Application from the Command Line
      1. 1.2.1. Problem
      2. 1.2.2. Solution
      3. 1.2.3. How It Works
        1. 1.2.3.1. The Code
        2. 1.2.3.2. Usage
    3. 1.3. Create and Use a Code Module
      1. 1.3.1. Problem
      2. 1.3.2. Solution
      3. 1.3.3. How It Works
        1. 1.3.3.1. Usage
    4. 1.4. Create and Use a Code Library from the Command Line
      1. 1.4.1. Problem
      2. 1.4.2. Solution
      3. 1.4.3. How It Works
        1. 1.4.3.1. Usage
    5. 1.5. Access Command-Line Arguments
      1. 1.5.1. Problem
      2. 1.5.2. Solution
      3. 1.5.3. How It Works
        1. 1.5.3.1. The Code
        2. 1.5.3.2. Usage
    6. 1.6. Include Code Selectively at Build Time
      1. 1.6.1. Problem
      2. 1.6.2. Solution
      3. 1.6.3. How It Works
        1. 1.6.3.1. The Code
        2. 1.6.3.2. Usage
      4. 1.6.4. Notes
    7. 1.7. Access a Program Element That Has the Same Name As a Keyword
      1. 1.7.1. Problem
      2. 1.7.2. Solution
      3. 1.7.3. How It Works
        1. 1.7.3.1. The Code
    8. 1.8. Create and Manage Strongly Named Key Pairs
      1. 1.8.1. Problem
      2. 1.8.2. Solution
      3. 1.8.3. How It Works
    9. 1.9. Give an Assembly a Strong Name
      1. 1.9.1. Problem
      2. 1.9.2. Solution
      3. 1.9.3. How It Works
        1. 1.9.3.1. The Code
        2. 1.9.3.2. Usage
    10. 1.10. Verify That a Strongly Named Assembly Has Not Been Modified
      1. 1.10.1. Problem
      2. 1.10.2. Solution
      3. 1.10.3. How It Works
    11. 1.11. Delay-Sign an Assembly
      1. 1.11.1. Problem
      2. 1.11.2. Solution
      3. 1.11.3. How It Works
    12. 1.12. Sign an Assembly with an Authenticode Digital Signature
      1. 1.12.1. Problem
      2. 1.12.2. Solution
      3. 1.12.3. How It Works
        1. 1.12.3.1. Usage
    13. 1.13. Create and Trust a Test Software Publisher Certificate
      1. 1.13.1. Problem
      2. 1.13.2. Solution
      3. 1.13.3. How It Works
    14. 1.14. Manage the Global Assembly Cache
      1. 1.14.1. Problem
      2. 1.14.2. Solution
      3. 1.14.3. How It Works
    15. 1.15. Prevent People from Decompiling Your Code
      1. 1.15.1. Problem
      2. 1.15.2. Solution
      3. 1.15.3. How It Works
    16. 1.16. Manipulate the Appearance of the Console
      1. 1.16.1. Problem
      2. 1.16.2. Solution
      3. 1.16.3. How It Works
        1. 1.16.3.1. The Code
    17. 1.17. Create a Static Class
      1. 1.17.1. Problem
      2. 1.17.2. Solution
      3. 1.17.3. How It Works
        1. 1.17.3.1. The Code
    18. 1.18. Create an Anonymous Type
      1. 1.18.1. Problem
      2. 1.18.2. Solution
      3. 1.18.3. How It Works
        1. 1.18.3.1. The Code
    19. 1.19. Create an ExpandoObject Dynamic Type
      1. 1.19.1. Problem
      2. 1.19.2. Solution
      3. 1.19.3. How It Works
        1. 1.19.3.1. The Code
    20. 1.20. Define an Automatically Implemented Property
      1. 1.20.1. Problem
      2. 1.20.2. Solution
      3. 1.20.3. How It Works
        1. 1.20.3.1. The Code
    21. 1.21. Overload an Operator
      1. 1.21.1. Problem
      2. 1.21.2. Solution
      3. 1.21.3. How It Works
        1. 1.21.3.1. The Code
    22. 1.22. Define a Conversion Operator
      1. 1.22.1. Problem
      2. 1.22.2. Solution
      3. 1.22.3. How It Works
        1. 1.22.3.1. The Code
    23. 1.23. Handle an Event with an Anonymous Function
      1. 1.23.1. Problem
      2. 1.23.2. Solution
      3. 1.23.3. How It Works
        1. 1.23.3.1. The Code
    24. 1.24. Implement a Custom Indexer
      1. 1.24.1. Problem
      2. 1.24.2. Solution
      3. 1.24.3. How It Works
        1. 1.24.3.1. The Code
  7. 2. Data Manipulation
    1. 2.1. Manipulate the Contents of a String Efficiently
      1. 2.1.1. Problem
      2. 2.1.2. Solution
      3. 2.1.3. How It Works
        1. 2.1.3.1. The Code
    2. 2.2. Encode a String Using Alternate Character Encoding
      1. 2.2.1. Problem
      2. 2.2.2. Solution
      3. 2.2.3. How It Works
        1. 2.2.3.1. The Code
        2. 2.2.3.2. Usage
      4. 2.2.4. Notes
    3. 2.3. Convert Basic Value Types to Byte Arrays
      1. 2.3.1. Problem
      2. 2.3.2. Solution
      3. 2.3.3. How It Works
        1. 2.3.3.1. The Code
    4. 2.4. Base64 Encode Binary Data
      1. 2.4.1. Problem
      2. 2.4.2. Solution
      3. 2.4.3. How It Works
        1. 2.4.3.1. The Code
    5. 2.5. Validate Input Using Regular Expressions
      1. 2.5.1. Problem
      2. 2.5.2. Solution
      3. 2.5.3. How It Works
        1. 2.5.3.1. The Code
        2. 2.5.3.2. Usage
      4. 2.5.4. Notes
    6. 2.6. Use Compiled Regular Expressions
      1. 2.6.1. Problem
      2. 2.6.2. Solution
      3. 2.6.3. How It Works
        1. 2.6.3.1. The Code
    7. 2.7. Create Dates and Times from Strings
      1. 2.7.1. Problem
      2. 2.7.2. Solution
      3. 2.7.3. How It Works
        1. 2.7.3.1. The Code
    8. 2.8. Add, Subtract, and Compare Dates and Times
      1. 2.8.1. Problem
      2. 2.8.2. Solution
      3. 2.8.3. How It Works
        1. 2.8.3.1. The Code
    9. 2.9. Sort an Array or a Collection
      1. 2.9.1. Problem
      2. 2.9.2. Solution
      3. 2.9.3. How It Works
        1. 2.9.3.1. The Code
    10. 2.10. Copy a Collection to an Array
      1. 2.10.1. Problem
      2. 2.10.2. Solution
      3. 2.10.3. How It Works
        1. 2.10.3.1. The Code
    11. 2.11. Use a Strongly Typed Collection
      1. 2.11.1. Problem
      2. 2.11.2. Solution
      3. 2.11.3. How It Works
        1. 2.11.3.1. The Code
    12. 2.12. Create a Generic Type
      1. 2.12.1. Problem
      2. 2.12.2. Solution
      3. 2.12.3. How It Works
        1. 2.12.3.1. The Code
    13. 2.13. Store a Serializable Object to a File
      1. 2.13.1. Problem
      2. 2.13.2. Solution
      3. 2.13.3. How It Works
        1. 2.13.3.1. The Code
    14. 2.14. Serialize an Object Using JSON
      1. 2.14.1. Problem
      2. 2.14.2. Solution
      3. 2.14.3. How It Works
        1. 2.14.3.1. The Code
    15. 2.15. Read User Input from the Console
      1. 2.15.1. Problem
      2. 2.15.2. Solution
      3. 2.15.3. How It Works
        1. 2.15.3.1. The Code
    16. 2.16. Using Large Integer Values
      1. 2.16.1. Problem
      2. 2.16.2. Solution
      3. 2.16.3. How It Works
        1. 2.16.3.1. The Code
    17. 2.17. Select Collection or Array Elements
      1. 2.17.1. Problem
      2. 2.17.2. Solution
      3. 2.17.3. How It Works
        1. 2.17.3.1. The Code
    18. 2.18. Remove Duplicate Items from an Array or Collection
      1. 2.18.1. Problem
      2. 2.18.2. Solution
      3. 2.18.3. How It Works
        1. 2.18.3.1. The Code
  8. 3. Application Domains, Reflection, and Metadata
    1. 3.1. Create an Application Domain
      1. 3.1.1. Problem
      2. 3.1.2. Solution
      3. 3.1.3. How It Works
        1. 3.1.3.1. The Code
    2. 3.2. Create Types That Can Be Passed Across Application Domain Boundaries
      1. 3.2.1. Problem
      2. 3.2.2. Solution
      3. 3.2.3. How It Works
        1. 3.2.3.1. The Code
    3. 3.3. Avoid Loading Unnecessary Assemblies into Application Domains
      1. 3.3.1. Problem
      2. 3.3.2. Solution
      3. 3.3.3. How It Works
        1. 3.3.3.1. The Code
    4. 3.4. Create a Type That Cannot Cross Application Domain Boundaries
      1. 3.4.1. Problem
      2. 3.4.2. Solution
      3. 3.4.3. How It Works
    5. 3.5. Load an Assembly into the Current Application Domain
      1. 3.5.1. Problem
      2. 3.5.2. Solution
      3. 3.5.3. How It Works
        1. 3.5.3.1. The Code
    6. 3.6. Execute an Assembly in a Different Application Domain
      1. 3.6.1. Problem
      2. 3.6.2. Solution
      3. 3.6.3. How It Works
        1. 3.6.3.1. The Code
        2. 3.6.3.2. Usage
    7. 3.7. Instantiate a Type in a Different Application Domain
      1. 3.7.1. Problem
      2. 3.7.2. Solution
      3. 3.7.3. How It Works
        1. 3.7.3.1. The Code
    8. 3.8. Pass Data Between Application Domains
      1. 3.8.1. Problem
      2. 3.8.2. Solution
      3. 3.8.3. How It Works
        1. 3.8.3.1. The Code
    9. 3.9. Unload Assemblies and Application Domains
      1. 3.9.1. Problem
      2. 3.9.2. Solution
      3. 3.9.3. How It Works
        1. 3.9.3.1. The Code
    10. 3.10. Retrieve Type Information
      1. 3.10.1. Problem
      2. 3.10.2. Solution
      3. 3.10.3. How It Works
        1. 3.10.3.1. The Code
    11. 3.11. Test an Object's Type
      1. 3.11.1. Problem
      2. 3.11.2. Solution
      3. 3.11.3. How It Works
        1. 3.11.3.1. The Code
    12. 3.12. Instantiate an Object Using Reflection
      1. 3.12.1. Problem
      2. 3.12.2. Solution
      3. 3.12.3. How It Works
        1. 3.12.3.1. The Code
    13. 3.13. Create a Custom Attribute
      1. 3.13.1. Problem
      2. 3.13.2. Solution
      3. 3.13.3. How It Works
        1. 3.13.3.1. The Code
        2. 3.13.3.2. Usage
    14. 3.14. Inspect the Attributes of a Program Element Using Reflection
      1. 3.14.1. Problem
      2. 3.14.2. Solution
      3. 3.14.3. How It Works
        1. 3.14.3.1. The Code
    15. 3.15. Programmatically Discover the Members of a Type
      1. 3.15.1. Problem
      2. 3.15.2. Solution
      3. 3.15.3. How It Works
        1. 3.15.3.1. The Code
    16. 3.16. Invoke a Type Member Using Reflection
      1. 3.16.1. Problem
      2. 3.16.2. Solution
      3. 3.16.3. How It Works
        1. 3.16.3.1. The Code
    17. 3.17. Dynamically Invoke a Type Member
      1. 3.17.1. Problem
      2. 3.17.2. Solution
      3. 3.17.3. How It Works
        1. 3.17.3.1. The Code
    18. 3.18. Create a Custom Dynamic Type
      1. 3.18.1. Problem
      2. 3.18.2. Solution
      3. 3.18.3. How It Works
        1. 3.18.3.1. The Code
  9. 4. Threads, Processes, and Synchronization
    1. 4.1. Execute a Method Using the Thread Pool
      1. 4.1.1. Problem
      2. 4.1.2. Solution
      3. 4.1.3. How It Works
        1. 4.1.3.1. The Code
      4. 4.1.4. Notes
    2. 4.2. Execute a Method Asynchronously
      1. 4.2.1. Problem
      2. 4.2.2. Solution
      3. 4.2.3. How It Works
        1. 4.2.3.1. The Code
    3. 4.3. Execute a Method Periodically
      1. 4.3.1. Problem
      2. 4.3.2. Solution
      3. 4.3.3. How It Works
        1. 4.3.3.1. The Code
    4. 4.4. Execute a Method at a Specific Time
      1. 4.4.1. Problem
      2. 4.4.2. Solution
      3. 4.4.3. How It Works
        1. 4.4.3.1. The Code
    5. 4.5. Execute a Method by Signaling a WaitHandle Object
      1. 4.5.1. Problem
      2. 4.5.2. Solution
      3. 4.5.3. How It Works
        1. 4.5.3.1. The Code
    6. 4.6. Execute a Method Using a New Thread
      1. 4.6.1. Problem
      2. 4.6.2. Solution
      3. 4.6.3. How It Works
        1. 4.6.3.1. The Code
    7. 4.7. Synchronize the Execution of Multiple Threads Using a Monitor
      1. 4.7.1. Problem
      2. 4.7.2. Solution
      3. 4.7.3. How It Works
        1. 4.7.3.1. The Code
    8. 4.8. Synchronize the Execution of Multiple Threads Using an Event
      1. 4.8.1. Problem
      2. 4.8.2. Solution
      3. 4.8.3. How It Works
        1. 4.8.3.1. The Code
    9. 4.9. Synchronize the Execution of Multiple Threads Using a Mutex
      1. 4.9.1. Problem
      2. 4.9.2. Solution
      3. 4.9.3. How It Works
        1. 4.9.3.1. The Code
    10. 4.10. Synchronize the Execution of Multiple Threads Using a Semaphore
      1. 4.10.1. Problem
      2. 4.10.2. Solution
      3. 4.10.3. How It Works
        1. 4.10.3.1. The Code
    11. 4.11. Synchronize Access to a Shared Data Value
      1. 4.11.1. Problem
      2. 4.11.2. Solution
      3. 4.11.3. How It Works
        1. 4.11.3.1. The Code
    12. 4.12. Know When a Thread Finishes
      1. 4.12.1. Problem
      2. 4.12.2. Solution
      3. 4.12.3. How It Works
        1. 4.12.3.1. The Code
    13. 4.13. Terminate the Execution of a Thread
      1. 4.13.1. Problem
      2. 4.13.2. Solution
      3. 4.13.3. How It Works
        1. 4.13.3.1. The Code
    14. 4.14. Create a Thread-Safe Collection Instance
      1. 4.14.1. Problem
      2. 4.14.2. Solution
      3. 4.14.3. How It Works
        1. 4.14.3.1. The Code
    15. 4.15. Start a New Process
      1. 4.15.1. Problem
      2. 4.15.2. Solution
      3. 4.15.3. How It Works
        1. 4.15.3.1. The Code
    16. 4.16. Terminate a Process
      1. 4.16.1. Problem
      2. 4.16.2. Solution
      3. 4.16.3. How It Works
        1. 4.16.3.1. The Code
    17. 4.17. Ensure That Only One Instance of an Application Can Execute Concurrently
      1. 4.17.1. Problem
      2. 4.17.2. Solution
      3. 4.17.3. How It Works
        1. 4.17.3.1. The Code
  10. 5. Files, Directories, and I/O
    1. 5.1. Retrieve Information About a File, Directory, or Drive
      1. 5.1.1. Problem
      2. 5.1.2. Solution
      3. 5.1.3. How It Works
        1. 5.1.3.1. The Code
        2. 5.1.3.2. Usage
    2. 5.2. Set File and Directory Attributes
      1. 5.2.1. Problem
      2. 5.2.2. Solution
      3. 5.2.3. How It Works
        1. 5.2.3.1. The Code
    3. 5.3. Copy, Move, or Delete a File or Directory
      1. 5.3.1. Problem
      2. 5.3.2. Solution
      3. 5.3.3. How It Works
        1. 5.3.3.1. The Code
    4. 5.4. Calculate the Size of a Directory
      1. 5.4.1. Problem
      2. 5.4.2. Solution
      3. 5.4.3. How It Works
        1. 5.4.3.1. The Code
    5. 5.5. Retrieve Version Information for a File
      1. 5.5.1. Problem
      2. 5.5.2. Solution
      3. 5.5.3. How It Works
        1. 5.5.3.1. The Code
        2. 5.5.3.2. Usage
    6. 5.6. Show a Just-in-Time Directory Tree in the TreeView Control
      1. 5.6.1. Problem
      2. 5.6.2. Solution
      3. 5.6.3. How It Works
        1. 5.6.3.1. The Code
    7. 5.7. Read and Write a Text File
      1. 5.7.1. Problem
      2. 5.7.2. Solution
      3. 5.7.3. How It Works
        1. 5.7.3.1. The Code
    8. 5.8. Read and Write a Binary File
      1. 5.8.1. Problem
      2. 5.8.2. Solution
      3. 5.8.3. How It Works
        1. 5.8.3.1. The Code
    9. 5.9. Read a File Asynchronously
      1. 5.9.1. Problem
      2. 5.9.2. Solution
      3. 5.9.3. How It Works
        1. 5.9.3.1. The Code
        2. 5.9.3.2. Usage
    10. 5.10. Find Files That Match a Wildcard Expression
      1. 5.10.1. Problem
      2. 5.10.2. Solution
      3. 5.10.3. How It Works
        1. 5.10.3.1. The Code
    11. 5.11. Test Two Files for Equality
      1. 5.11.1. Problem
      2. 5.11.2. Solution
      3. 5.11.3. How It Works
        1. 5.11.3.1. The Code
    12. 5.12. Manipulate Strings Representing File Names
      1. 5.12.1. Problem
      2. 5.12.2. Solution
      3. 5.12.3. How It Works
    13. 5.13. Determine If a Path Is a Directory or a File
      1. 5.13.1. Problem
      2. 5.13.2. Solution
      3. 5.13.3. How It Works
        1. 5.13.3.1. The Code
    14. 5.14. Work with Relative Paths
      1. 5.14.1. Problem
      2. 5.14.2. Solution
      3. 5.14.3. How It Works
        1. 5.14.3.1. The Code
        2. 5.14.3.2. Usage
    15. 5.15. Create a Temporary File
      1. 5.15.1. Problem
      2. 5.15.2. Solution
      3. 5.15.3. How It Works
        1. 5.15.3.1. The Code
    16. 5.16. Get the Total Free Space on a Drive
      1. 5.16.1. Problem
      2. 5.16.2. Solution
      3. 5.16.3. How It Works
        1. 5.16.3.1. The Code
    17. 5.17. Show the Common File Dialog Boxes
      1. 5.17.1. Problem
      2. 5.17.2. Solution
      3. 5.17.3. How It Works
        1. 5.17.3.1. The Code
    18. 5.18. Use an Isolated Store
      1. 5.18.1. Problem
      2. 5.18.2. Solution
      3. 5.18.3. How It Works
        1. 5.18.3.1. The Code
    19. 5.19. Monitor the File System for Changes
      1. 5.19.1. Problem
      2. 5.19.2. Solution
      3. 5.19.3. How It Works
        1. 5.19.3.1. The Code
    20. 5.20. Access a COM Port
      1. 5.20.1. Problem
      2. 5.20.2. Solution
      3. 5.20.3. How It Works
        1. 5.20.3.1. The Code
    21. 5.21. Get a Random File Name
      1. 5.21.1. Problem
      2. 5.21.2. Solution
      3. 5.21.3. How It Works
        1. 5.21.3.1. The Code
    22. 5.22. Manipulate the Access Control List of a File or Directory
      1. 5.22.1. Problem
      2. 5.22.2. Solution
      3. 5.22.3. How It Works
        1. 5.22.3.1. The Code
    23. 5.23. Compress Data
      1. 5.23.1. Problem
      2. 5.23.2. Solution
      3. 5.23.3. How It Works
        1. 5.23.3.1. The Code
    24. 5.24. Log Data to a File
      1. 5.24.1. Problem
      2. 5.24.2. Solution
      3. 5.24.3. How It Works
        1. 5.24.3.1. The Code
    25. 5.25. Process a Log File
      1. 5.25.1. Problem
      2. 5.25.2. Solution
      3. 5.25.3. How It Works
        1. 5.25.3.1. The Code
    26. 5.26. Communicate Between Processes
      1. 5.26.1. Problem
      2. 5.26.2. Solution
      3. 5.26.3. How It Works
        1. 5.26.3.1. The Code
  11. 6. XML Processing
    1. 6.1. Show the Structure of an XML Document in a TreeView
      1. 6.1.1. Problem
      2. 6.1.2. Solution
      3. 6.1.3. How It Works
        1. 6.1.3.1. The Code
        2. 6.1.3.2. Usage
    2. 6.2. Insert Nodes in an XML Document
      1. 6.2.1. Problem
      2. 6.2.2. Solution
      3. 6.2.3. How It Works
        1. 6.2.3.1. The Code
    3. 6.3. Quickly Append Nodes in an XML Document
      1. 6.3.1. Problem
      2. 6.3.2. Solution
      3. 6.3.3. How It Works
        1. 6.3.3.1. The Code
    4. 6.4. Find Specific Elements by Name
      1. 6.4.1. Problem
      2. 6.4.2. Solution
      3. 6.4.3. How It Works
        1. 6.4.3.1. The Code
      4. 6.4.4. Notes
    5. 6.5. Get XML Nodes in a Specific XML Namespace
      1. 6.5.1. Problem
      2. 6.5.2. Solution
      3. 6.5.3. How It Works
        1. 6.5.3.1. The Code
    6. 6.6. Find Elements with an XPath Search
      1. 6.6.1. Problem
      2. 6.6.2. Solution
      3. 6.6.3. How It Works
        1. 6.6.3.1. The Code
      4. 6.6.4. Notes
    7. 6.7. Read and Write XML Without Loading an Entire Document into Memory
      1. 6.7.1. Problem
      2. 6.7.2. Solution
        1. 6.7.2.1. How It Works
        2. 6.7.2.2. The Code
    8. 6.8. Validate an XML Document Against a Schema
      1. 6.8.1. Problem
      2. 6.8.2. Solution
      3. 6.8.3. How It Works
        1. 6.8.3.1. The Code
    9. 6.9. Use XML Serialization with Custom Objects
      1. 6.9.1. Problem
      2. 6.9.2. Solution
      3. 6.9.3. How It Works
        1. 6.9.3.1. The Code
    10. 6.10. Create a Schema for a .NET Class
      1. 6.10.1. Problem
      2. 6.10.2. Solution
      3. 6.10.3. How It Works
        1. 6.10.3.1. Usage
    11. 6.11. Generate a Class from a Schema
      1. 6.11.1. Problem
      2. 6.11.2. Solution
      3. 6.11.3. How It Works
        1. 6.11.3.1. Usage
    12. 6.12. Perform an XSL Transform
      1. 6.12.1. Problem
      2. 6.12.2. Solution
      3. 6.12.3. How It Works
        1. 6.12.3.1. The Code
    13. 6.13. Load XML with LINQ
      1. 6.13.1. Problem
      2. 6.13.2. Solution
      3. 6.13.3. How It Works
        1. 6.13.3.1. The Code
    14. 6.14. Create a New XML Tree with LINQ
      1. 6.14.1. Problem
      2. 6.14.2. Solution
      3. 6.14.3. How It Works
        1. 6.14.3.1. The Code
    15. 6.15. Query XML with LINQ
      1. 6.15.1. Problem
      2. 6.15.2. Solution
      3. 6.15.3. How It Works
        1. 6.15.3.1. The Code
    16. 6.16. Modify an XML Tree with LINQ
      1. 6.16.1. The Problem
      2. 6.16.2. The Solution
      3. 6.16.3. How It Works
        1. 6.16.3.1. The Code
  12. 7. Windows Forms
    1. 7.1. Add a Control Programmatically
      1. 7.1.1. Problem
      2. 7.1.2. Solution
      3. 7.1.3. How It Works
        1. 7.1.3.1. The Code
    2. 7.2. Store Data with a Control
      1. 7.2.1. Problem
      2. 7.2.2. Solution
      3. 7.2.3. How It Works
        1. 7.2.3.1. The Code
    3. 7.3. Process All the Controls on a Form
      1. 7.3.1. Problem
      2. 7.3.2. Solution
      3. 7.3.3. How It Works
        1. 7.3.3.1. The Code
    4. 7.4. Track the Visible Forms in an Application
      1. 7.4.1. Problem
      2. 7.4.2. Solution
      3. 7.4.3. How It Works
        1. 7.4.3.1. The Code
      4. 7.4.4. Notes
    5. 7.5. Find All MDI Child Forms
      1. 7.5.1. Problem
      2. 7.5.2. Solution
      3. 7.5.3. How It Works
        1. 7.5.3.1. The Code
    6. 7.6. Save Configuration Settings for a Form
      1. 7.6.1. Problem
      2. 7.6.2. Solution
      3. 7.6.3. How It Works
        1. 7.6.3.1. The Code
    7. 7.7. Force a List Box to Scroll to the Most Recently Added Item
      1. 7.7.1. Problem
      2. 7.7.2. Solution
      3. 7.7.3. How It Works
        1. 7.7.3.1. The Code
    8. 7.8. Restrict a Text Box to Accept Only Specific Input
      1. 7.8.1. Problem
      2. 7.8.2. Solution
      3. 7.8.3. How It Works
        1. 7.8.3.1. The Code
      4. 7.8.4. Notes
    9. 7.9. Use an Autocomplete Combo Box or Text Box
      1. 7.9.1. Problem
      2. 7.9.2. Solution
      3. 7.9.3. How It Works
        1. 7.9.3.1. The Code
    10. 7.10. Sort a List View by Any Column
      1. 7.10.1. Problem
      2. 7.10.2. Solution
      3. 7.10.3. How It Works
        1. 7.10.3.1. The Code
    11. 7.11. Lay Out Controls Automatically
      1. 7.11.1. Problem
      2. 7.11.2. Solution
      3. 7.11.3. How It Works
    12. 7.12. Use Part of a Main Menu for a Context Menu
      1. 7.12.1. Problem
      2. 7.12.2. Solution
      3. 7.12.3. How It Works
        1. 7.12.3.1. The Code
    13. 7.13. Make a Multilingual Form
      1. 7.13.1. Problem
      2. 7.13.2. Solution
      3. 7.13.3. How It Works
        1. 7.13.3.1. The Code
    14. 7.14. Create a Form That Cannot Be Moved
      1. 7.14.1. Problem
      2. 7.14.2. Solution
      3. 7.14.3. How It Works
        1. 7.14.3.1. The Code
    15. 7.15. Make a Borderless Form Movable
      1. 7.15.1. Problem
      2. 7.15.2. Solution
      3. 7.15.3. How It Works
        1. 7.15.3.1. The Code
    16. 7.16. Create an Animated System Tray Icon
      1. 7.16.1. Problem
      2. 7.16.2. Solution
      3. 7.16.3. How It Works
        1. 7.16.3.1. The Code
    17. 7.17. Validate an Input Control
      1. 7.17.1. Problem
      2. 7.17.2. Solution
      3. 7.17.3. How It Works
        1. 7.17.3.1. The Code
    18. 7.18. Use a Drag-and-Drop Operation
      1. 7.18.1. Problem
      2. 7.18.2. Solution
      3. 7.18.3. How It Works
        1. 7.18.3.1. The Code
    19. 7.19. Update the User Interface in a Multithreaded Application
      1. 7.19.1. Problem
      2. 7.19.2. Solution
      3. 7.19.3. How It Works
        1. 7.19.3.1. The Code
    20. 7.20. Display a Web Page in a Windows-Based Application
      1. 7.20.1. Problem
      2. 7.20.2. Solution
      3. 7.20.3. How It Works
        1. 7.20.3.1. The Code
    21. 7.21. Display WPF Windows in a Windows Forms Application
      1. 7.21.1. Problem
      2. 7.21.2. Solution
      3. 7.21.3. How It Works
        1. 7.21.3.1. The Code
    22. 7.22. Display WPF Controls in Windows Forms
      1. 7.22.1. Problem
      2. 7.22.2. Solution
      3. 7.22.3. How It Works
        1. 7.22.3.1. The Code
  13. 8. Graphics, Multimedia, and Printing
    1. 8.1. Find All Installed Fonts
      1. 8.1.1. Problem
      2. 8.1.2. Solution
      3. 8.1.3. How It Works
        1. 8.1.3.1. The Code
    2. 8.2. Perform Hit Testing with Shapes
      1. 8.2.1. Problem
      2. 8.2.2. Solution
      3. 8.2.3. How It Works
        1. 8.2.3.1. The Code
    3. 8.3. Create an Irregularly Shaped Control
      1. 8.3.1. Problem
      2. 8.3.2. Solution
      3. 8.3.3. How It Works
        1. 8.3.3.1. The Code
    4. 8.4. Create a Movable Sprite
      1. 8.4.1. Problem
      2. 8.4.2. Solution
      3. 8.4.3. How It Works
        1. 8.4.3.1. The Code
    5. 8.5. Create a Scrollable Image
      1. 8.5.1. Problem
      2. 8.5.2. Solution
      3. 8.5.3. How It Works
        1. 8.5.3.1. The Code
    6. 8.6. Perform a Screen Capture
      1. 8.6.1. Problem
      2. 8.6.2. Solution
      3. 8.6.3. How It Works
        1. 8.6.3.1. The Code
    7. 8.7. Use Double Buffering to Increase Redraw Speed
      1. 8.7.1. Problem
      2. 8.7.2. Solution
      3. 8.7.3. How It Works
        1. 8.7.3.1. The Code
    8. 8.8. Show a Thumbnail for an Image
      1. 8.8.1. Problem
      2. 8.8.2. Solution
      3. 8.8.3. How It Works
        1. 8.8.3.1. The Code
    9. 8.9. Play a Simple Beep or System Sound
      1. 8.9.1. Problem
      2. 8.9.2. Solution
      3. 8.9.3. How It Works
        1. 8.9.3.1. The Code
    10. 8.10. Play a WAV File
      1. 8.10.1. Problem
      2. 8.10.2. Solution
      3. 8.10.3. How It Works
        1. 8.10.3.1. The Code
    11. 8.11. Play a Sound File
      1. 8.11.1. Problem
      2. 8.11.2. Solution
      3. 8.11.3. How It Works
        1. 8.11.3.1. The Code
    12. 8.12. Play a Video
      1. 8.12.1. Problem
      2. 8.12.2. Solution
      3. 8.12.3. How It Works
        1. 8.12.3.1. The Code
    13. 8.13. Retrieve Information About Installed Printers
      1. 8.13.1. Problem
      2. 8.13.2. Solution
      3. 8.13.3. How It Works
        1. 8.13.3.1. The Code
        2. 8.13.3.2. Usage
    14. 8.14. Print a Simple Document
      1. 8.14.1. Problem
      2. 8.14.2. Solution
      3. 8.14.3. How It Works
        1. 8.14.3.1. The Code
    15. 8.15. Print a Multipage Document
      1. 8.15.1. Problem
      2. 8.15.2. Solution
      3. 8.15.3. How It Works
        1. 8.15.3.1. The Code
    16. 8.16. Print Wrapped Text
      1. 8.16.1. Problem
      2. 8.16.2. Solution
      3. 8.16.3. How It Works
        1. 8.16.3.1. The Code
    17. 8.17. Show a Dynamic Print Preview
      1. 8.17.1. Problem
      2. 8.17.2. Solution
      3. 8.17.3. How It Works
        1. 8.17.3.1. The Code
    18. 8.18. Manage Print Jobs
      1. 8.18.1. Problem
      2. 8.18.2. Solution
      3. 8.18.3. How It Works
        1. 8.18.3.1. The Code
    19. 8.19. Perform Text-to-Speech
      1. 8.19.1. Problem
      2. 8.19.2. Solution
      3. 8.19.3. How It Works
        1. 8.19.3.1. The Code
    20. 8.20. Recognize Characters in an Image (OCR)
      1. 8.20.1. Problem
      2. 8.20.2. Solution
      3. 8.20.3. How It Works
        1. 8.20.3.1. The Code
  14. 9. Database Access
    1. 9.1. Connect to a Database
      1. 9.1.1. Problem
      2. 9.1.2. Solution
      3. 9.1.3. How It Works
        1. 9.1.3.1. The Code
    2. 9.2. Use Connection Pooling
      1. 9.2.1. Problem
      2. 9.2.2. Solution
      3. 9.2.3. How It Works
        1. 9.2.3.1. The Code
      4. 9.2.4. Notes
    3. 9.3. Create a Database Connection String Programmatically
      1. 9.3.1. Problem
      2. 9.3.2. Solution
      3. 9.3.3. How It Works
        1. 9.3.3.1. The Code
    4. 9.4. Store a Database Connection String Securely
      1. 9.4.1. Problem
      2. 9.4.2. Solution
      3. 9.4.3. How It Works
        1. 9.4.3.1. The Code
    5. 9.5. Execute a SQL Command or Stored Procedure
      1. 9.5.1. Problem
      2. 9.5.2. Solution
      3. 9.5.3. How It Works
        1. 9.5.3.1. The Code
    6. 9.6. Use Parameters in a SQL Command or Stored Procedure
      1. 9.6.1. Problem
      2. 9.6.2. Solution
      3. 9.6.3. How It Works
        1. 9.6.3.1. The Code
    7. 9.7. Process the Results of a SQL Query Using a Data Reader
      1. 9.7.1. Problem
      2. 9.7.2. Solution
      3. 9.7.3. How It Works
        1. 9.7.3.1. The Code
    8. 9.8. Obtain an XML Document from a SQL Server Query
      1. 9.8.1. Problem
      2. 9.8.2. Solution
      3. 9.8.3. How It Works
        1. 9.8.3.1. The Code
    9. 9.9. Perform Asynchronous Database Operations Against SQL Server
      1. 9.9.1. Problem
      2. 9.9.2. Solution
      3. 9.9.3. How It Works
        1. 9.9.3.1. The Code
    10. 9.10. Write Database-Independent Code
      1. 9.10.1. Problem
      2. 9.10.2. Solution
      3. 9.10.3. How It Works
        1. 9.10.3.1. The Code
    11. 9.11. Discover All Instances of SQL Server on Your Network
      1. 9.11.1. Problem
      2. 9.11.2. Solution
      3. 9.11.3. How It Works
        1. 9.11.3.1. The Code
    12. 9.12. Create an In-Memory Cache
      1. 9.12.1. Problem
      2. 9.12.2. Solution
      3. 9.12.3. How It Works
        1. 9.12.3.1. The Code
    13. 9.13. Create a DataSet Programmatically
      1. 9.13.1. Problem
      2. 9.13.2. Solution
      3. 9.13.3. How It Works
        1. 9.13.3.1. The Code
    14. 9.14. Perform a LINQ Query
      1. 9.14.1. Problem
      2. 9.14.2. Solution
      3. 9.14.3. How It Works
        1. 9.14.3.1. The Code
    15. 9.15. Perform a LINQ Query with Entity Types
      1. 9.15.1. Problem
      2. 9.15.2. Solution
      3. 9.15.3. How It Works
        1. 9.15.3.1. The Code
    16. 9.16. Compare LINQ DataSet Results
      1. 9.16.1. Problem
      2. 9.16.2. Solution
      3. 9.16.3. How It Works
        1. 9.16.3.1. The Code
  15. 10. Networking
    1. 10.1. Obtain Information About the Local Network Interface
      1. 10.1.1. Problem
      2. 10.1.2. Solution
      3. 10.1.3. How It Works
        1. 10.1.3.1. The Code
    2. 10.2. Detect Changes in Network Connectivity
      1. 10.2.1. Problem
      2. 10.2.2. Solution
      3. 10.2.3. How It Works
        1. 10.2.3.1. The Code
    3. 10.3. Download Data over HTTP or FTP
      1. 10.3.1. Problem
      2. 10.3.2. Solution
      3. 10.3.3. How It Works
        1. 10.3.3.1. The Code
      4. 10.3.4. Notes
    4. 10.4. Download a File and Process It Using a Stream
      1. 10.4.1. Problem
      2. 10.4.2. Solution
      3. 10.4.3. How It Works
        1. 10.4.3.1. The Code
    5. 10.5. Respond to HTTP Requests from Within Your Application
      1. 10.5.1. Problem
      2. 10.5.2. Solution
      3. 10.5.3. How It Works
        1. 10.5.3.1. The Code
    6. 10.6. Get an HTML Page from a Site That Requires Authentication
      1. 10.6.1. Problem
      2. 10.6.2. Solution
      3. 10.6.3. How It Works
        1. 10.6.3.1. The Code
    7. 10.7. Send E-mail Using SMTP
      1. 10.7.1. Problem
      2. 10.7.2. Solution
      3. 10.7.3. How It Works
        1. 10.7.3.1. The Code
    8. 10.8. Resolve a Host Name to an IP Address
      1. 10.8.1. Problem
      2. 10.8.2. Solution
      3. 10.8.3. How It Works
        1. 10.8.3.1. The Code
        2. 10.8.3.2. Usage
    9. 10.9. Ping an IP Address
      1. 10.9.1. Problem
      2. 10.9.2. Solution
      3. 10.9.3. How It Works
        1. 10.9.3.1. The Code
        2. 10.9.3.2. Usage
    10. 10.10. Communicate Using TCP
      1. 10.10.1. Problem
      2. 10.10.2. Solution
      3. 10.10.3. How It Works
        1. 10.10.3.1. The Code
        2. 10.10.3.2. Usage
    11. 10.11. Create a Multithreaded TCP Server That Supports Asynchronous Communications
      1. 10.11.1. Problem
      2. 10.11.2. Solution
      3. 10.11.3. How It Works
        1. 10.11.3.1. The Code
    12. 10.12. Communicate Using UDP
      1. 10.12.1. Problem
      2. 10.12.2. Solution
      3. 10.12.3. How It Works
        1. 10.12.3.1. The Code
    13. 10.13. Create a SOAP-Based Web Service
      1. 10.13.1. Problem
      2. 10.13.2. Solution
      3. 10.13.3. How It Works
        1. 10.13.3.1. The Code
    14. 10.14. Call a WCF Service Using a Dynamically Generated Service Proxy
      1. 10.14.1. Problem
      2. 10.14.2. Solution
      3. 10.14.3. How It Works
        1. 10.14.3.1. The Code
    15. 10.15. Process the Content of an Atom or RSS Feed
      1. 10.15.1. Problem
      2. 10.15.2. Solution
      3. 10.15.3. How It Works
        1. 10.15.3.1. The Code
    16. 10.16. Manipulate URIs
      1. 10.16.1. Problem
      2. 10.16.2. Solution
      3. 10.16.3. How It Works
        1. 10.16.3.1. The Code
  16. 11. Security and Cryptography
    1. 11.1. Allow Partially Trusted Code to Use Your Strongly Named Assembly
      1. 11.1.1. Problem
      2. 11.1.2. Solution
      3. 11.1.3. How It Works
        1. 11.1.3.1. The Code
      4. 11.1.4. Notes
    2. 11.2. Disable Code Access Security
      1. 11.2.1. Problem
      2. 11.2.2. Solution
      3. 11.2.3. How It Works
    3. 11.3. Disable Execution Permission Checks
      1. 11.3.1. Problem
      2. 11.3.2. Solution
      3. 11.3.3. How It Works
        1. 11.3.3.1. The Code
      4. 11.3.4. Notes
    4. 11.4. Ensure the Runtime Grants Specific Permissions to Your Assembly
      1. 11.4.1. Problem
      2. 11.4.2. Solution
      3. 11.4.3. How It Works
        1. 11.4.3.1. The Code
    5. 11.5. Limit the Permissions Granted to Your Assembly
      1. 11.5.1. Problem
      2. 11.5.2. Solution
      3. 11.5.3. How It Works
        1. 11.5.3.1. The Code
    6. 11.6. View the Permissions Required by an Assembly
      1. 11.6.1. Problem
      2. 11.6.2. Solution
      3. 11.6.3. How It Works
        1. 11.6.3.1. The Code
        2. 11.6.3.2. Usage
    7. 11.7. Determine at Runtime If Your Code Has a Specific Permission
      1. 11.7.1. Problem
      2. 11.7.2. Solution
      3. 11.7.3. How It Works
        1. 11.7.3.1. The Code
    8. 11.8. Restrict Who Can Extend Your Classes and Override Class Members
      1. 11.8.1. Problem
      2. 11.8.2. Solution
      3. 11.8.3. How It Works
        1. 11.8.3.1. The Code
    9. 11.9. Inspect an Assembly's Evidence
      1. 11.9.1. Problem
      2. 11.9.2. Solution
      3. 11.9.3. How It Works
        1. 11.9.3.1. The Code
    10. 11.10. Determine If the Current User Is a Member of a Specific Windows Group
      1. 11.10.1. Problem
      2. 11.10.2. Solution
      3. 11.10.3. How It Works
        1. 11.10.3.1. The Code
        2. 11.10.3.2. Usage
    11. 11.11. Restrict Which Users Can Execute Your Code
      1. 11.11.1. Problem
      2. 11.11.2. Solution
      3. 11.11.3. How It Works
        1. 11.11.3.1. The Code
    12. 11.12. Impersonate a Windows User
      1. 11.12.1. Problem
      2. 11.12.2. Solution
      3. 11.12.3. How It Works
        1. 11.12.3.1. The Code
        2. 11.12.3.2. Usage
    13. 11.13. Create a Cryptographically Random Number
      1. 11.13.1. Problem
      2. 11.13.2. Solution
      3. 11.13.3. How It Works
        1. 11.13.3.1. The Code
    14. 11.14. Calculate the Hash Code of a Password
      1. 11.14.1. Problem
      2. 11.14.2. Solution
      3. 11.14.3. How It Works
        1. 11.14.3.1. The Code
        2. 11.14.3.2. Usage
    15. 11.15. Calculate the Hash Code of a File
      1. 11.15.1. Problem
      2. 11.15.2. Solution
      3. 11.15.3. How It Works
        1. 11.15.3.1. The Code
        2. 11.15.3.2. Usage
    16. 11.16. Verify a Hash Code
      1. 11.16.1. Problem
      2. 11.16.2. Solution
      3. 11.16.3. How It Works
        1. 11.16.3.1. The Code
    17. 11.17. Ensure Data Integrity Using a Keyed Hash Code
      1. 11.17.1. Problem
      2. 11.17.2. Solution
      3. 11.17.3. How It Works
        1. 11.17.3.1. The Code
        2. 11.17.3.2. Usage
    18. 11.18. Work with Security-Sensitive Strings in Memory
      1. 11.18.1. Problem
      2. 11.18.2. Solution
      3. 11.18.3. How It Works
        1. 11.18.3.1. The Code
    19. 11.19. Encrypt and Decrypt Data Using the Data Protection API
      1. 11.19.1. Problem
      2. 11.19.2. Solution
      3. 11.19.3. How It Works
        1. 11.19.3.1. The Code
  17. 12. Unmanaged Code Interoperability
    1. 12.1. Call a Function in an Unmanaged DLL
      1. 12.1.1. Problem
      2. 12.1.2. Solution
      3. 12.1.3. How It Works
        1. 12.1.3.1. The Code
    2. 12.2. Get the Handle for a Control, Window, or File
      1. 12.2.1. Problem
      2. 12.2.2. Solution
      3. 12.2.3. How It Works
        1. 12.2.3.1. The Code
    3. 12.3. Call an Unmanaged Function That Uses a Structure
      1. 12.3.1. Problem
      2. 12.3.2. Solution
      3. 12.3.3. How It Works
        1. 12.3.3.1. The Code
    4. 12.4. Call an Unmanaged Function That Uses a Callback
      1. 12.4.1. Problem
      2. 12.4.2. Solution
      3. 12.4.3. How It Works
        1. 12.4.3.1. The Code
    5. 12.5. Retrieve Unmanaged Error Information
      1. 12.5.1. Problem
      2. 12.5.2. Solution
      3. 12.5.3. How It Works
        1. 12.5.3.1. The Code
    6. 12.6. Use a COM Component in a .NET Client
      1. 12.6.1. Problem
      2. 12.6.2. Solution
      3. 12.6.3. How It Works
        1. 12.6.3.1. The Code
    7. 12.7. Release a COM Component Quickly
      1. 12.7.1. Problem
      2. 12.7.2. Solution
      3. 12.7.3. How It Works
    8. 12.8. Use Optional Parameters
      1. 12.8.1. Problem
      2. 12.8.2. Solution
      3. 12.8.3. How It Works
        1. 12.8.3.1. The Code
    9. 12.9. Use an ActiveX Control in a .NET Client
      1. 12.9.1. Problem
      2. 12.9.2. Solution
      3. 12.9.3. How It Works
    10. 12.10. Expose a .NET Component Through COM
      1. 12.10.1. Problem
      2. 12.10.2. Solution
      3. 12.10.3. How It Works
  18. 13. Commonly Used Interfaces and Patterns
    1. 13.1. Implement a Custom Serializable Type
      1. 13.1.1. Problem
      2. 13.1.2. Solution
      3. 13.1.3. How It Works
        1. 13.1.3.1. The Code
    2. 13.2. Implement a Cloneable Type
      1. 13.2.1. Problem
      2. 13.2.2. Solution
      3. 13.2.3. How It Works
        1. 13.2.3.1. The Code
    3. 13.3. Implement a Comparable Type
      1. 13.3.1. Problem
      2. 13.3.2. Solution
      3. 13.3.3. How It Works
        1. 13.3.3.1. The Code
        2. 13.3.3.2. Usage
    4. 13.4. Implement an Enumerable Collection
      1. 13.4.1. Problem
      2. 13.4.2. Solution
      3. 13.4.3. How It Works
        1. 13.4.3.1. The Code
    5. 13.5. Implement an Enumerable Type Using a Custom Iterator
      1. 13.5.1. Problem
      2. 13.5.2. Solution
      3. 13.5.3. How It Works
        1. 13.5.3.1. The Code
    6. 13.6. Implement a Disposable Class
      1. 13.6.1. Problem
      2. 13.6.2. Solution
      3. 13.6.3. How It Works
        1. 13.6.3.1. The Code
    7. 13.7. Implement a Formattable Type
      1. 13.7.1. Problem
      2. 13.7.2. Solution
      3. 13.7.3. How It Works
        1. 13.7.3.1. The Code
        2. 13.7.3.2. Usage
    8. 13.8. Implement a Custom Exception Class
      1. 13.8.1. Problem
      2. 13.8.2. Solution
      3. 13.8.3. How It Works
        1. 13.8.3.1. The Code
    9. 13.9. Implement a Custom Event Argument
      1. 13.9.1. Problem
      2. 13.9.2. Solution
      3. 13.9.3. How It Works
        1. 13.9.3.1. The Code
    10. 13.10. Implement the Singleton Pattern
      1. 13.10.1. Problem
      2. 13.10.2. Solution
      3. 13.10.3. How It Works
        1. 13.10.3.1. The Code
        2. 13.10.3.2. Usage
    11. 13.11. Implement the Observer Pattern
      1. 13.11.1. Problem
      2. 13.11.2. Solution
      3. 13.11.3. How It Works
        1. 13.11.3.1. The Code
        2. 13.11.3.2. Usage
    12. 13.12. Implement a Parallel Producer-Consumer Pattern
      1. 13.12.1. Problem
      2. 13.12.2. Solution
      3. 13.12.3. How It Works
        1. 13.12.3.1. The Code
    13. 13.13. Perform Lazy Object Initialization
      1. 13.13.1. Problem
      2. 13.13.2. Solution
      3. 13.13.3. How It Works
        1. 13.13.3.1. The Code
    14. 13.14. Use Optional Parameters
      1. 13.14.1. Problem
      2. 13.14.2. Solution
      3. 13.14.3. How It Works
        1. 13.14.3.1. The Code
    15. 13.15. Add a Method to a Type Without Modifying It
      1. 13.15.1. Problem
      2. 13.15.2. Solution
      3. 13.15.3. How It Works
        1. 13.15.3.1. The Code
    16. 13.16. Call an Object Member Dynamically
      1. 13.16.1. Problem
      2. 13.16.2. Solution
      3. 13.16.3. How It Works
        1. 13.16.3.1. The Code
    17. 13.17. Create a Variant Generic Type
      1. 13.17.1. Problem
      2. 13.17.2. Solution
      3. 13.17.3. How It Works
        1. 13.17.3.1. The Code
  19. 14. Windows Integration
    1. 14.1. Access Runtime Environment Information
      1. 14.1.1. Problem
      2. 14.1.2. Solution
      3. 14.1.3. How It Works
        1. 14.1.3.1. The Code
    2. 14.2. Retrieve the Value of an Environment Variable
      1. 14.2.1. Problem
      2. 14.2.2. Solution
      3. 14.2.3. How It Works
        1. 14.2.3.1. The Code
    3. 14.3. Write an Event to the Windows Event Log
      1. 14.3.1. Problem
      2. 14.3.2. Solution
      3. 14.3.3. How It Works
        1. 14.3.3.1. The Code
    4. 14.4. Read and Write to the Windows Registry
      1. 14.4.1. Problem
      2. 14.4.2. Solution
      3. 14.4.3. How It Works
        1. 14.4.3.1. The Code
    5. 14.5. Search the Windows Registry
      1. 14.5.1. Problem
      2. 14.5.2. Solution
      3. 14.5.3. How It Works
        1. 14.5.3.1. The Code
        2. 14.5.3.2. Usage
    6. 14.6. Create a Windows Service
      1. 14.6.1. Problem
      2. 14.6.2. Solution
      3. 14.6.3. How It Works
        1. 14.6.3.1. The Code
        2. 14.6.3.2. Usage
    7. 14.7. Create a Windows Service Installer
      1. 14.7.1. Problem
      2. 14.7.2. Solution
      3. 14.7.3. How It Works
        1. 14.7.3.1. The Code
        2. 14.7.3.2. Usage
    8. 14.8. Create a Shortcut on the Desktop or Start Menu
      1. 14.8.1. Problem
      2. 14.8.2. Solution
      3. 14.8.3. How It Works
        1. 14.8.3.1. The Code
    9. 14.9. Create a Windows 7 Jump List
      1. 14.9.1. Problem
      2. 14.9.2. Solution
      3. 14.9.3. How It Works
        1. 14.9.3.1. The Code
    10. 14.10. Use Windows Search
      1. 14.10.1. Problem
      2. 14.10.2. Solution
      3. 14.10.3. How It Works
        1. 14.10.3.1. The Code
    11. 14.11. Check Internet Connectivity
      1. 14.11.1. Problem
      2. 14.11.2. Solution
      3. 14.11.3. How It Works
        1. 14.11.3.1. The Code
    12. 14.12. Display a Task Dialog
      1. 14.12.1. Problem
      2. 14.12.2. Solution
      3. 14.12.3. How It Works
        1. 14.12.3.1. The Code
    13. 14.13. Write Custom Performance Counters
      1. 14.13.1. Problem
      2. 14.13.2. Solution
      3. 14.13.3. How It Works
        1. 14.13.3.1. The Code
    14. 14.14. Read Performance Counters
      1. 14.14.1. Problem
      2. 14.14.2. Solution
      3. 14.14.3. How It Works
        1. 14.14.3.1. The Code
    15. 14.15. Obtain Elevated Privileges
      1. 14.15.1. Problem
      2. 14.15.2. Solution
      3. 14.15.3. How It Works
        1. 14.15.3.1. The Code
  20. 15. Parallel Programming
    1. 15.1. Perform Simple Parallel Tasks
      1. 15.1.1. Problem
      2. 15.1.2. Solution
      3. 15.1.3. How It Works
        1. 15.1.3.1. The Code
    2. 15.2. Return a Result from a Task
      1. 15.2.1. Problem
      2. 15.2.2. Solution
      3. 15.2.3. How It Works
        1. 15.2.3.1. The Code
    3. 15.3. Wait for Tasks to Complete
      1. 15.3.1. Problem
      2. 15.3.2. Solution
      3. 15.3.3. How It Works
        1. 15.3.3.1. The Code
    4. 15.4. Parallel Process a Collection
      1. 15.4.1. Problem
      2. 15.4.2. Solution
      3. 15.4.3. How It Works
        1. 15.4.3.1. The Code
    5. 15.5. Chain Tasks Together
      1. 15.5.1. Problem
      2. 15.5.2. Solution
      3. 15.5.3. How It Works
        1. 15.5.3.1. The Code
    6. 15.6. Write a Cooperative Algorithm
      1. 15.6.1. Problem
      2. 15.6.2. Solution
      3. 15.6.3. How It Works
        1. 15.6.3.1. The Code
    7. 15.7. Handle Exceptions in Tasks
      1. 15.7.1. Problem
      2. 15.7.2. Solution
      3. 15.7.3. How It Works
        1. 15.7.3.1. The Code
    8. 15.8. Cancel a Task
      1. 15.8.1. Problem
      2. 15.8.2. Solution
      3. 15.8.3. How It Works
        1. 15.8.3.1. The Code
    9. 15.9. Share Data Between Tasks
      1. 15.9.1. Problem
      2. 15.9.2. Solution
      3. 15.9.3. How It Works
        1. 15.9.3.1. The Code
  21. 16. Using LINQ
    1. 16.1. Perform a Simple LINQ Query
      1. 16.1.1. Problem
      2. 16.1.2. Solution
      3. 16.1.3. How It Works
        1. 16.1.3.1. The Code
    2. 16.2. Filter Items from a Data Source
      1. 16.2.1. Problem
      2. 16.2.2. Solution
      3. 16.2.3. How It Works
        1. 16.2.3.1. The Code
    3. 16.3. Filter a Data Source by Type
      1. 16.3.1. Problem
      2. 16.3.2. Solution
      3. 16.3.3. How It Works
        1. 16.3.3.1. The Code
    4. 16.4. Filter Ranges of Elements
      1. 16.4.1. Problem
      2. 16.4.2. Solution
      3. 16.4.3. How It Works
        1. 16.4.3.1. The Code
    5. 16.5. Select Multiple Member Values
      1. 16.5.1. Problem
      2. 16.5.2. Solution
      3. 16.5.3. How It Works
        1. 16.5.3.1. The Code
    6. 16.6. Filter and Select from Multiple Data Sources
      1. 16.6.1. Problem
      2. 16.6.2. Solution
      3. 16.6.3. How It Works
        1. 16.6.3.1. The Code
    7. 16.7. Use Permutations of Data Sources
      1. 16.7.1. Problem
      2. 16.7.2. Solution
      3. 16.7.3. How It Works
        1. 16.7.3.1. The Code
    8. 16.8. Concatenate Data Sources
      1. 16.8.1. Problem
      2. 16.8.2. Solution
      3. 16.8.3. How It Works
        1. 16.8.3.1. The Code
    9. 16.9. Group Result Elements by Attribute
      1. 16.9.1. Problem
      2. 16.9.2. Solution
      3. 16.9.3. How It Works
        1. 16.9.3.1. The Code
    10. 16.10. Sort Query Results
      1. 16.10.1. Problem
      2. 16.10.2. Solution
      3. 16.10.3. How It Works
        1. 16.10.3.1. The Code
    11. 16.11. Compare Data Sources
      1. 16.11.1. Problem
      2. 16.11.2. The Solution
      3. 16.11.3. How It Works
        1. 16.11.3.1. The Code
    12. 16.12. Aggregate Data Sources
      1. 16.12.1. Problem
      2. 16.12.2. Solution
      3. 16.12.3. How It Works
        1. 16.12.3.1. The Code
    13. 16.13. Share Values Within a Query
      1. 16.13.1. Problem
      2. 16.13.2. Solution
      3. 16.13.3. How It Works
        1. 16.13.3.1. The Code
    14. 16.14. Create Custom LINQ Extension Methods
      1. 16.14.1. Problem
      2. 16.14.2. Solution
      3. 16.14.3. How It Works
        1. 16.14.3.1. The Code
    15. 16.15. Convert from IEnumerable<>
      1. 16.15.1. Problem
      2. 16.15.2. Solution
      3. 16.15.3. How It Works
        1. 16.15.3.1. The Code
  22. 17. Windows Presentation Foundation
    1. 17.1. Create and Use a Dependency Property
      1. 17.1.1. Problem
      2. 17.1.2. Solution
      3. 17.1.3. How It Works
        1. 17.1.3.1. The Code
    2. 17.2. Create and Use an Attached Property
      1. 17.2.1. Problem
      2. 17.2.2. Solution
      3. 17.2.3. How It Works
        1. 17.2.3.1. The Code
    3. 17.3. Define Application-Wide Resources
      1. 17.3.1. Problem
      2. 17.3.2. Solution
      3. 17.3.3. How It Works
        1. 17.3.3.1. The Code
    4. 17.4. Debug Data Bindings Using an IValueConverter
      1. 17.4.1. Problem
      2. 17.4.2. Solution
      3. 17.4.3. How It Works
        1. 17.4.3.1. The Code
    5. 17.5. Debug Bindings Using Attached Properties
      1. 17.5.1. Problem
      2. 17.5.2. Solution
      3. 17.5.3. How It Works
        1. 17.5.3.1. The Code
    6. 17.6. Arrange UI Elements in a Horizontal or Vertical Stack
      1. 17.6.1. Problem
      2. 17.6.2. Solution
      3. 17.6.3. How It Works
        1. 17.6.3.1. The Code
    7. 17.7. Dock UI Elements to the Edges of a Form
      1. 17.7.1. Problem
      2. 17.7.2. Solution
      3. 17.7.3. How It Works
        1. 17.7.3.1. The Code
    8. 17.8. Arrange UI Elements in a Grid
      1. 17.8.1. Problem
      2. 17.8.2. Solution
      3. 17.8.3. How It Works
        1. 17.8.3.1. The Code
    9. 17.9. Position UI Elements Using Exact Coordinates
      1. 17.9.1. Problem
      2. 17.9.2. Solution
      3. 17.9.3. How It Works
        1. 17.9.3.1. The Code
    10. 17.10. Get Rich Text Input from a User
      1. 17.10.1. Problem
      2. 17.10.2. Solution
      3. 17.10.3. How It Works
        1. 17.10.3.1. The Code
    11. 17.11. Display a Control Rotated
      1. 17.11.1. Problem
      2. 17.11.2. Solution
      3. 17.11.3. How It Works
        1. 17.11.3.1. The Code
    12. 17.12. Create a User Control
      1. 17.12.1. Problem
      2. 17.12.2. Solution
      3. 17.12.3. How It Works
        1. 17.12.3.1. The Code
    13. 17.13. Support Application Commands in a User Control
      1. 17.13.1. Problem
      2. 17.13.2. Solution
      3. 17.13.3. How It Works
        1. 17.13.3.1. The Code
    14. 17.14. Create a Lookless Custom Control
      1. 17.14.1. Problem
      2. 17.14.2. Solution
      3. 17.14.3. How It Works
        1. 17.14.3.1. The Code
    15. 17.15. Create a Two-Way Binding
      1. 17.15.1. Problem
      2. 17.15.2. Solution
      3. 17.15.3. How It Works
        1. 17.15.3.1. The Code
    16. 17.16. Bind to a Command
      1. 17.16.1. Problem
      2. 17.16.2. Solution
      3. 17.16.3. How It Works
        1. 17.16.3.1. The Code
    17. 17.17. Use Data Templates to Display Bound Data
      1. 17.17.1. Problem
      2. 17.17.2. Solution
      3. 17.17.3. How It Works
        1. 17.17.3.1. The Code
    18. 17.18. Bind to a Collection with the Master-Detail Pattern
      1. 17.18.1. Problem
      2. 17.18.2. Solution
      3. 17.18.3. How It Works
        1. 17.18.3.1. The Code
    19. 17.19. Change a Control's Appearance on Mouseover
      1. 17.19.1. Problem
      2. 17.19.2. Solution
      3. 17.19.3. How It Works
        1. 17.19.3.1. The Code
    20. 17.20. Change the Appearance of Alternate Itemsin a List
      1. 17.20.1. Problem
      2. 17.20.2. Solution
      3. 17.20.3. How It Works
        1. 17.20.3.1. The Code
    21. 17.21. Drag Items from a List and Drop Them onaCanvas
      1. 17.21.1. Problem
      2. 17.21.2. Solution
      3. 17.21.3. How It Works
        1. 17.21.3.1. The Code
    22. 17.22. Display the Progress of a Long-Running Operation and Allow the User to Cancel It
      1. 17.22.1. Problem
      2. 17.22.2. Solution
      3. 17.22.3. How It Works
        1. 17.22.3.1. The Code
    23. 17.23. Draw Two-Dimensional Shapes
      1. 17.23.1. Problem
      2. 17.23.2. Solution
      3. 17.23.3. How It Works
        1. 17.23.3.1. The Code
    24. 17.24. Create Reusable Shapes
      1. 17.24.1. Problem
      2. 17.24.2. Solution
      3. 17.24.3. How It Works
        1. 17.24.3.1. The Code
    25. 17.25. Draw or Fill a Shape Using a Solid Color
      1. 17.25.1. Problem
      2. 17.25.2. Solution
      3. 17.25.3. How It Works
        1. 17.25.3.1. The Code
    26. 17.26. Fill a Shape with a Linear or Radial Color Gradient
      1. 17.26.1. Problem
      2. 17.26.2. Solution
      3. 17.26.3. How It Works
        1. 17.26.3.1. The Code
    27. 17.27. Fill a Shape with an Image
      1. 17.27.1. Problem
      2. 17.27.2. Solution
      3. 17.27.3. How It Works
        1. 17.27.3.1. The Code
    28. 17.28. Fill a Shape with a Pattern or Texture
      1. 17.28.1. Problem
      2. 17.28.2. Solution
      3. 17.28.3. How It Works
        1. 17.28.3.1. The Code
    29. 17.29. Animate the Property of a Control
      1. 17.29.1. Problem
      2. 17.29.2. Solution
      3. 17.29.3. How It Works
        1. 17.29.3.1. The Code
    30. 17.30. Animate Several Properties in Parallel
      1. 17.30.1. Problem
      2. 17.30.2. Solution
      3. 17.30.3. How It Works
        1. 17.30.3.1. The Code
    31. 17.31. Create a Keyframe-Based Animation
      1. 17.31.1. Problem
      2. 17.31.2. Solution
      3. 17.31.3. How It Works
        1. 17.31.3.1. The Code
    32. 17.32. Animate an Object Along a Path
      1. 17.32.1. Problem
      2. 17.32.2. Solution
      3. 17.32.3. How It Works
        1. 17.32.3.1. The Code
    33. 17.33. Play a Media File
      1. 17.33.1. Problem
      2. 17.33.2. Solution
      3. 17.33.3. How It Works
        1. 17.33.3.1. The Code
    34. 17.34. Query Keyboard State
      1. 17.34.1. Problem
      2. 17.34.2. Solution
      3. 17.34.3. How It Works
        1. 17.34.3.1. The Code

Product information

  • Title: Visual C# 2010 Recipes: A Problem-Solution Approach
  • Author(s): Allen Jones, Adam Freeman
  • Release date: March 2010
  • Publisher(s): Apress
  • ISBN: 9781430225256