www.gibmonks.com

C# Cookbook TOC 2

Recipe3.26.Building Cloneable Classes
Recipe3.27.Assuring an Object's Disposal
Recipe3.28.Releasing a COM Object Through Managed Code
Recipe3.29.Creating an Object Cache
Recipe3.30.Rolling Back Object Changes
Recipe3.31.Disposing of Unmanaged Resources
Recipe3.32.Determining Where Boxing and Unboxing Occur
Chapter 4. Generics
Introduction
Recipe4.1.Deciding When and Where to Use Generics
Recipe4.2.Understanding Generic Types
Recipe4.3.Getting the Type of a Generic Type
Recipe4.4.Replacing the ArrayList with Its Generic Counterpart
Recipe4.5.Replacing the Stack and Queue with Their Generic Counterparts
Recipe4.6.Implementing a Linked List
Recipe4.7.Creating a Value Type That Can Be Initialized to Null
Recipe4.8.Reversing the Contents of a Sorted List
Recipe4.9.Making Read-Only Collections the Generic Way
Recipe4.10.Replacing the Hashtable with Its Generic Counterpart
Recipe4.11.Using foreach with Generic Dictionary Types
Recipe4.12.Constraining Type Arguments
Recipe4.13.Initializing Generic Variables to Their Default Values
Chapter 5. Collections
Introduction
Recipe5.1.Swapping Two Elements in an Array
Recipe5.2.Reversing an Array Quickly
Recipe5.3.Reversing a Two-Dimensional Array
Recipe5.4.Reversing a Jagged Array
Recipe5.5.Writing a More Flexible StackTrace Class
Recipe5.6.Determining the Number of Times an Item Appears in a List<T>
Recipe5.7.Retrieving All Instances of a Specific Item in a List<T>
Recipe5.8.Inserting and Removing Items from an Array
Recipe5.9.Keeping Your List<T> Sorted
Recipe5.10.Sorting a Dictionary's Keys and/or Values
Recipe5.11.Creating a Dictionary with Max and Min Value Boundaries
Recipe5.12.Displaying an Array's Data as a Delimited String
Recipe5.13.Storing Snapshots of Lists in an Array
Recipe5.14.Persisting a Collection Between Application Sessions
Recipe5.15.Testing Every Element in an Array or List<T>
Recipe5.16.Performing an Action on Each Element in an Array or List<T>
Recipe5.17.Creating a Read-Only Array or List<T>
Chapter 6. Iterators and Partial Types
Introduction
Recipe6.1.Implementing Nested foreach Functionality in a Class
Recipe6.2.Creating Custom Enumerators
Recipe6.3.Creating an Iterator on a Generic Type
Recipe6.4.Creating an Iterator on a Non-generic Type
Recipe6.5.Creating Iterators That Accept Parameters
Recipe6.6.Adding Multiple Iterators on a Single Type
Recipe6.7.Implementing Iterators as Overloaded Operators
Recipe6.8.Forcing an Iterator to Stop Iterating
Recipe6.9.Dealing with Finally Blocks and Iterators
Recipe6.10.Organizing Your Interface Implementations
Recipe6.11.Generating Code That Is No Longer in Your Main Code Paths
Chapter 7. Exception Handling
Introduction
Recipe7.1.Verifying Critical Parameters
Recipe7.2.Knowing When to Catch and Rethrow Exceptions
Recipe7.3.Identifying Exceptions and Their Usage
Recipe7.4.Handling Derived Exceptions Individually
Recipe7.5.Assuring Exceptions Are Not Lost When Using Finally Blocks
Recipe7.6.Handling Exceptions Thrown from Methods Invoked via Reflection
Recipe7.7.Debugging Problems When Loading an Assembly
Recipe7.8.Mapping Back and Forth Between Managed Exceptions and HRESULTs
Recipe7.9.Handling User-Defined HRESULTs
Recipe7.10.Preventing Unhandled Exceptions
Recipe7.11.Getting Exception Information
Recipe7.12.Getting to the Root of a Problem Quickly
Recipe7.13.Creating a New Exception Type
Recipe7.14.Obtaining a Stack Trace
Recipe7.15.Breaking on a First-Chance Exception
Recipe7.16.Preventing the Nefarious TypeInitializationException
Recipe7.17.Handling Exceptions Thrown from an Asynchronous Delegate
Recipe7.18.Giving Exceptions the Extra Info They Need with Exception.Data
Recipe7.19.Looking at Exceptions in a New Way Using Visualizers
Recipe7.20.Dealing with Unhandled Exceptions in WinForms Applications
Chapter 8. Diagnostics
Introduction
Recipe8.1.Controlling Tracing Output in Production Code
Recipe8.2.Providing Fine-Grained Control over Debugging/Tracing Output
Recipe8.3.Creating Your Own Custom Switch Class
Recipe8.4.Compiling Blocks of Code Conditionally
Recipe8.5.Determining Whether a Process Has Stopped Responding
Recipe8.6.Using Event Logs in Your Application
Recipe8.7.Changing the Maximum Size of a Custom Event Log
Recipe8.8.Searching Event Log Entries
Recipe8.9.Watching the Event Log for a Specific Entry
Recipe8.10.Finding All Sources Belonging to a Specific Event Log
Recipe8.11.Implementing a Simple Performance Counter
Recipe8.12.Implementing Performance Counters That Require a Base Counter
Recipe8.13.Enabling and Disabling Complex Tracing Code
Recipe8.14.Capturing Standard Output for a Process
Recipe8.15.Creating Custom Debugging Displays for Your Classes
Recipe8.16.Determining Current appdomain Settings Information
Recipe8.17.Boosting the Priority of a Process Programmatically
Recipe8.18.Looking at Your Runtime Environment and Seeing What You Can Do About It
Chapter 9. Delegates, Events, and Anonymous Methods
Introduction
Recipe9.1.Controlling When and If a Delegate Fires Within a Multicast Delegate
Recipe9.2.Obtaining Return Values from Each Delegate in a Multicast Delegate