Books & Videos

Table of Contents

  1. Chapter 1 Language Integrated Query (LINQ)

    1. Introduction

    2. Query a Message Queue

    3. Using Set Semantics with Data

    4. Reuse Parameterized Queries with LINQ to SQL

    5. Sort Results in a Culture-Sensitive Manner

    6. Adding Functional Extensions for Use with LINQ

    7. Query and Join Across Data Repositories

    8. Querying Configuration Files with LINQ

    9. Creating XML Straight from a Database

    10. Being Selective About Your Query Results

    11. Using LINQ with Collections That Don't Support IEnumerable<T>

  2. Chapter 2 Strings and Characters

    1. Introduction

    2. Determining the Kind of Character a Char Contains

    3. Controlling Case Sensitivity When Comparing Two Characters

    4. Finding the Location of All Occurrences of a String Within Another String

    5. Controlling Case Sensitivity When Comparing Two Strings

    6. Comparing a String to the Beginning or End of a Second String

    7. Inserting Text into a String

    8. Removing or Replacing Characters Within a String

    9. Encoding Binary Data As Base64

    10. Decoding a Base64-Encoded Binary

    11. Converting a String Returned As a Byte[] Back into a String

    12. Passing a String to a Method That Accepts Only a Byte[]

    13. Converting Strings to Other Types

    14. Creating a Delimited String

    15. Extracting Items from a Delimited String

    16. Iterating over Each Character in a String

    17. Pruning Characters from the Head and/or Tail of a String

    18. Testing a String for Null or Empty

    19. Appending a Line

  3. Chapter 3 Classes and Structures

    1. Introduction

    2. Creating Union-Type Structures

    3. Making a Type Sortable

    4. Making a Type Searchable

    5. Indirectly Overloading the +=, -=, /=, and *= Operators

    6. Indirectly Overloading the &&, ||, and ?: Operators

    7. Making Error-Free Expressions

    8. Reducing Your Boolean Logic

    9. Converting Between Simple Types in a Programming Language-Agnostic Manner

    10. Determining When to Use the cast Operator, the as Operator, or the is Operator

    11. Casting with the as Operator

    12. Determining a Variable's Type with the is Operator

    13. Returning Multiple Items from a Method

    14. Parsing Command-Line Parameters

    15. Initializing a Constant Field at Runtime

    16. Building Cloneable Classes

    17. Assuring an Object's Disposal

    18. Disposing of Unmanaged Resources

    19. Determining Where Boxing and Unboxing Occur

  4. Chapter 4 Generics

    1. Introduction

    2. Deciding When and Where to Use Generics

    3. Understanding Generic Types

    4. Replacing the ArrayList with Its Generic Counterpart

    5. Replacing the Stack and Queue with Their Generic Counterparts

    6. Using a Linked List

    7. Creating a Value Type That Can Be Initialized to Null

    8. Reversing the Contents of a Sorted List

    9. Making Read-Only Collections the Generic Way

    10. Replacing the Hashtable with Its Generic Counterpart

    11. Using foreach with Generic Dictionary Types

    12. Constraining Type Arguments

    13. Initializing Generic Variables to Their Default Values

  5. Chapter 5 Collections

    1. Introduction

    2. Swapping Two Elements in an Array

    3. Reversing an Array Quickly

    4. Writing a More Flexible StackTrace Class

    5. Determining the Number of Times an Item Appears in a List<T>

    6. Retrieving All Instances of a Specific Item in a List<T>

    7. Inserting and Removing Items from an Array

    8. Keeping Your List<T> Sorted

    9. Sorting a Dictionary's Keys and/or Values

    10. Creating a Dictionary with Max and Min Value Boundaries

    11. Storing Snapshots of Lists in an Array

    12. Persisting a Collection Between Application Sessions

    13. Testing Every Element in an Array or List<T>

    14. Performing an Action on Each Element in an Array or List<T>

    15. Creating a Read-Only Array or List<T>

  6. Chapter 6 Iterators, Partial Types, and Partial Methods

    1. Introduction

    2. Creating an lterator on a Generic Type

    3. Creating an Iterator on a Nongeneric Type

    4. Creating Custom Enumerators

    5. Implementing Iterator Logic

    6. Forcing an Iterator to Stop Iterating

    7. Dealing with Finally Blocks and Iterators

    8. Implementing Nested foreach Functionality in a Class

    9. Organizing Your Interface Implementations

    10. Generating Code That Is No Longer in Your Main Code Paths

    11. Adding Hooks to Generated Entities

  7. Chapter 7 Exception Handling

    1. Introduction

    2. Knowing When to Catch and Rethrow Exceptions

    3. Assuring Exceptions Are Not Lost When Using Finally Blocks

    4. Handling Exceptions Thrown from Methods Invoked via Reflection

    5. Preventing Unhandled Exceptions

    6. Getting Exception Information

    7. Getting to the Root of a Problem Quickly

    8. Creating a New Exception Type

    9. Obtaining a Stack Trace

    10. Breaking on a First-Chance Exception

    11. Handling Exceptions Thrown from an Asynchronous Delegate

    12. Giving Exceptions the Extra Info They Need with Exception.Data

    13. Dealing with Unhandled Exceptions in WinForms Applications

    14. Dealing with Unhandled Exceptions in Windows Presentation Foundation (WPF) Applications

    15. Analyzing Exceptions for Common Errors

  8. Chapter 8 Diagnostics

    1. Introduction

    2. Providing Fine-Grained Control over Debugging/ Tracing Output

    3. Determining Whether a Process Has Stopped Responding

    4. Using Event Logs in Your Application

    5. Searching Event Log Entries

    6. Watching the Event Log for a Specific Entry

    7. Implementing a Simple Performance Counter

    8. Enabling and Disabling Complex Tracing Code

    9. Capturing Standard Output for a Process

    10. Creating Custom Debugging Displays for Your Classes

  9. Chapter 9 Delegates, Events, and Lambda Expressions

    1. Introduction

    2. Controlling When and If a Delegate Fires Within a Multicast Delegate

    3. Obtaining Return Values from Each Delegate in a Multicast Delegate

    4. Handling Exceptions Individually for Each Delegate in a Multicast Delegate

    5. Converting Delegate Invocation from Synchronous to Asynchronous

    6. An Advanced Interface Search Mechanism

    7. Observing Additions and Modifications to Dictionaries

    8. Using Lambda Expressions

    9. Set Up Event Handlers Without the Mess

    10. Using Different Parameter Modifiers in Lambda Expressions

    11. Using Closures in C#

    12. Performing Multiple Operations on a List Using Functors

  10. Chapter 10 Regular Expressions

    1. Introduction

    2. Enumerating Matches

    3. Extracting Groups from a MatchCollection

    4. Verifying the Syntax of a Regular Expression

    5. Quickly Finding Only the Last Match in a String

    6. Augmenting the Basic String Replacement Function

    7. Implementing a Better Tokenizer

    8. Counting Lines of Text

    9. Returning the Entire Line in Which a Match Is Found

    10. Finding a Particular Occurrence of a Match

    11. Using Common Patterns

  11. Chapter 11 Data Structures and Algorithms

    1. Introduction

    2. Creating a Hash Code for a Data Type

    3. Creating a Priority Queue

    4. Creating a One-to-Many Map (MultiMap)

    5. Creating a Binary Search Tree

    6. Creating an n-ary Tree

    7. Using a HashSet Object

  12. Chapter 12 Filesystem I/O

    1. Introduction

    2. Manipulating File Attributes

    3. Renaming a File

    4. Outputting a Platform-Independent EOL Character

    5. Manipulating Directory Attributes

    6. Renaming a Directory

    7. Searching for Directories or Files Using Wildcards

    8. Obtaining the Directory Tree

    9. Parsing a Path

    10. Parsing Paths in Environment Variables

    11. Launching and Interacting with Console Utilities

    12. Locking Subsections of a File

    13. Waiting for an Action to Occur in the Filesystem

    14. Comparing Version Information of Two Executable Modules

    15. Querying Information for All Drives on a System

    16. Compressing and Decompressing Your Files

  13. Chapter 13 Reflection

    1. Introduction

    2. Listing Referenced Assemblies

    3. Listing Exported Types

    4. Finding Overridden Methods

    5. Finding Members in an Assembly

    6. Determining and Obtaining Nested Types Within an Assembly

    7. Displaying the Inheritance Hierarchy for a Type

    8. Finding the Subclasses of a Type

    9. Finding All Serializable Types Within an Assembly

    10. Dynamically Invoking Members

    11. Determining If a Type or Method Is Generic

    12. Accessing Local Variable Information

    13. Creating a Generic Type

  14. Chapter 14 Web

    1. Introduction

    2. Converting an IP Address to a Hostname

    3. Converting a Hostname to an IP Address

    4. Parsing a URI

    5. Handling Web Server Errors

    6. Communicating with a Web Server

    7. Going Through a Proxy

    8. Obtaining the HTML from a URL

    9. Using the Web Browser Control

    10. Tying Database Tables to the Cache

    11. Prebuilding an ASP.NET Web SiteProgrammatically

    12. Escaping and Unescaping Data for the Web

    13. Using the UriBuilder Class

    14. Inspect and Change Your Web Application Configuration

    15. Using Cached Results When Working with HTTP for Faster Performance

    16. Checking Out a Web Server's Custom Error Pages

  15. Chapter 15 xml

    1. Introduction

    2. Reading and Accessing XML Data in Document Order

    3. Reading XML on the Web

    4. Querying the Contents of an XML Document

    5. Validating XML

    6. Creating an XML Document Programmatically

    7. Detecting Changes to an XML Document

    8. Handling Invalid Characters in an XML String

    9. Transforming XML

    10. Tearing Apart an XML Document

    11. Putting Together an XML Document

    12. Validating Modified XML Documents Without Reloading

    13. Extending Transformations

    14. Getting Your Schemas in Bulk from Existing XML Files

    15. Passing Parameters to Transformations

  16. Chapter 16 Networking

    1. Introduction

    2. Writing a TCP Server

    3. Writing a TCP Client

    4. Simulating Form Execution

    5. Transferring Data via HTTP

    6. Using Named Pipes to Communicate

    7. Pinging Programmatically

    8. Send SMTP Mail Using the SMTP Service

    9. Use Sockets to Scan the Ports on a Machine

    10. Use the Current Internet Connection Settings

    11. Transferring Files Using FTP

  17. Chapter 17 Security

    1. Introduction

    2. Controlling Access to Types in a Local Assembly

    3. Encrypting/Decrypting a String

    4. Encrypting and Decrypting a File

    5. Cleaning Up Cryptography Information

    6. Verifying That a String Remains Uncorrupted Following Transmission

    7. Storing Data Securely

    8. Making a Security Assert Safe

    9. Verifying That an Assembly Has Been Granted Specific Permissions

    10. Minimizing the Attack Surface of an Assembly

    11. Obtaining Security/Audit Information

    12. Granting/Revoking Access to a File or Registry Key

    13. Protecting String Data with Secure Strings

    14. Securing Stream Data

    15. Encrypting web.config Information

    16. Obtaining the Full Reason a SecurityException Was Thrown

    17. Achieving Secure Unicode Encoding

    18. Obtaining a Safer File Handle

  18. Chapter 18 Threading and Synchronization

    1. Introduction

    2. Creating Per-Thread Static Fields

    3. Providing Thread-Safe Access to Class Members

    4. Preventing Silent Thread Termination

    5. Being Notified of the Completion of an Asynchronous Delegate

    6. Storing Thread-Specific Data Privately

    7. Granting Multiple Access to Resources with a Semaphore

    8. Synchronizing Multiple Processes with the Mutex

    9. Using Events to Make Threads Cooperate

    10. Get the Naming Rights for Your Events

    11. Performing Atomic Operations Among Threads

    12. Optimizing Read-Mostly Access

  19. Chapter 19 Toolbox

    1. Introduction

    2. Dealing with Operating System Shutdown, Power Management, or User Session Changes

    3. Controlling a Service

    4. List What Processes an Assembly Is Loaded In

    5. Using Message Queues on a Local Workstation

    6. Finding the Path to the Current Framework Version

    7. Determining the Versions of an Assembly That Are Registered in the Global Assembly Cache (GAC)

    8. Capturing Output from the Standard Output Stream

    9. Running Code in Its Own AppDomain

    10. Determining the Operating System and Service Pack Version of the Current Operating System

  20. Chapter 20 Numbers and Enumerations

    1. Introduction

    2. Converting Between Degrees and Radians

    3. Using the Bitwise Complement Operator with Various Data Types

    4. Converting a Number in Another Base to Base10

    5. Determining Whether a String Is a Valid Number

    6. Rounding a Floating-Point Value

    7. Choosing a Rounding Algorithm

    8. Converting Between Temperature Scales

    9. Safely Performing a Narrowing Numeric Cast

    10. Displaying an Enumeration Value as a String

    11. Converting Plain Text to an Equivalent Enumeration Value

    12. Testing for a Valid Enumeration Value

    13. Testing for a Valid Enumeration of Flags

    14. Using Enumerated Members in a Bit Mask

    15. Determining Whether One or More Enumeration Flags Are Set

    16. Determining the Integral Part of a Decimal or Double