Illustrated C# 2008

Book description

The unique, visual format of Illustrated C# 2008 has been specially created by author, and teacher of development methods, Daniel Solis. The concise text, use of tables to clarify language features, frequent figures and diagrams, as well as focused code samples all combine to create a unique approach that will help you understand and get to work with C# fast.

It was while teaching numerous seminars on various programming languages that the author realized the immense power diagrams have in explaining programming language concepts. Most people learn quicker and retain information better when the material is presented in a clean, simple, visual format. To achieve this result in his book, Solis uses concise text and bulleted lists, tables to clarify and summarize language features, as well as his renowned, ubiquitous figures and diagrams. Each language feature is illustrated with a concise and focused code sample for complete clarity.

Following an overview of the .NET platform and the role played by C#, you'll soon move into exploring the C# language in its entirety, including all the new C# 2008 features right down to the most complex topics involved in C#. If you're a C++ or VB programmer migrating to C# 2008, this book will be invaluable; the unique visual approach offers a far from lightweight treatment of C# 2008, so even the most experienced programmers will come away with a deeper understanding of the C# language.

Table of contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Acknowledgments
  5. Introduction
  6. 1. C# and the .NET Framework
    1. 1.1. Before .NET
      1. 1.1.1. Windows Programming in the Late 1990s
      2. 1.1.2. Goals for the Next-Generation Platform
    2. 1.2. Enter Microsoft .NET
      1. 1.2.1. Components of the .NET Framework
      2. 1.2.2. An Improved Programming Environment
        1. 1.2.2.1. Object-Oriented Development Environment
        2. 1.2.2.2. Automatic Garbage Collection
        3. 1.2.2.3. Interoperability
        4. 1.2.2.4. No COM Required
        5. 1.2.2.5. Simplified Deployment
        6. 1.2.2.6. Type Safety
        7. 1.2.2.7. The Base Class Library
    3. 1.3. Compiling to the Common Intermediate Language (CIL)
    4. 1.4. Compiling to Native Code and Execution
      1. 1.4.1. Overview of Compilation and Execution
    5. 1.5. The Common Language Runtime (CLR)
    6. 1.6. The Common Language Infrastructure (CLI)
      1. 1.6.1. Important Parts of the CLI
        1. 1.6.1.1. Common Type System (CTS)
        2. 1.6.1.2. Common Language Specification (CLS)
    7. 1.7. Review of the Acronyms
  7. 2. Overview of C# Programming
    1. 2.1. A Simple C# Program
    2. 2.2. More About SimpleProgram
    3. 2.3. Identifiers and Keywords
    4. 2.4. Naming Conventions
    5. 2.5. Keywords
    6. 2.6. Main: The Starting Point of a Program
    7. 2.7. Whitespace
    8. 2.8. Statements
    9. 2.9. Simple Statements
    10. 2.10. Blocks
    11. 2.11. Text Output from a Program
    12. 2.12. Write
    13. 2.13. WriteLine
    14. 2.14. The Format String
    15. 2.15. Multiple Markers and Values
    16. 2.16. Comments: Annotating the Code
    17. 2.17. More About Comments
    18. 2.18. Documentation Comments
    19. 2.19. Summary of Comment Types
  8. 3. Types, Storage, and Variables
    1. 3.1. A C# Program Is a Set of Type Declarations
    2. 3.2. A Type Is a Template
    3. 3.3. Instantiating a Type
    4. 3.4. Data Members and Function Members
      1. 3.4.1. Types of Members
    5. 3.5. Predefined Types
      1. 3.5.1. More About the Predefined Types
    6. 3.6. User-Defined Types
    7. 3.7. The Stack and the Heap
      1. 3.7.1. The Stack
        1. 3.7.1.1. Facts About Stacks
      2. 3.7.2. The Heap
    8. 3.8. Value Types and Reference Types
      1. 3.8.1. Storing Members of a Reference Type Object
      2. 3.8.2. Categorizing the C# Types
    9. 3.9. Variables
      1. 3.9.1. Variable Declarations
        1. 3.9.1.1. Variable Initializers
        2. 3.9.1.2. Automatic Initialization
      2. 3.9.2. Multiple-Variable Declarations
      3. 3.9.3. Using the Value of a Variable
  9. 4. Classes: The Basics
    1. 4.1. Overview of Classes
      1. 4.1.1. A Class Is an Active Data Structure
    2. 4.2. Programs and Classes: A Quick Example
    3. 4.3. Declaring a Class
    4. 4.4. Class Members
      1. 4.4.1. Fields
        1. 4.4.1.1. Explicit and Implicit Field Initialization
        2. 4.4.1.2. Declarations with Multiple Fields
      2. 4.4.2. Methods
    5. 4.5. Creating Variables and Instances of a Class
    6. 4.6. Allocating Memory for the Data
      1. 4.6.1. Combining the Steps
    7. 4.7. Instance Members
    8. 4.8. Access Modifiers
      1. 4.8.1. Private and Public Access
        1. 4.8.1.1. Depicting Public and Private Access
        2. 4.8.1.2. Example of Member Access
    9. 4.9. Accessing Members from Inside the Class
    10. 4.10. Accessing Members from Outside the Class
    11. 4.11. Putting It All Together
  10. 5. Methods
    1. 5.1. The Structure of a Method
      1. 5.1.1. Code Execution in the Method Body
    2. 5.2. Local Variables
      1. 5.2.1. Type Inference and the var Keyword
      2. 5.2.2. Local Variables Inside Nested Blocks
    3. 5.3. Local Constants
      1. 5.3.1. Flow of Control
    4. 5.4. Method Invocations
    5. 5.5. Return Values
      1. 5.5.1. The Return Statement and Void Methods
    6. 5.6. Parameters
      1. 5.6.1. Formal Parameters
      2. 5.6.2. Actual Parameters
        1. 5.6.2.1. An Example of Methods with Input Parameters
    7. 5.7. Value Parameters
    8. 5.8. Reference Parameters
    9. 5.9. Output Parameters
    10. 5.10. Parameter Arrays
      1. 5.10.1. Method Invocation
        1. 5.10.1.1. Expanded Form
      2. 5.10.2. Arrays As Actual Parameters
    11. 5.11. Summary of Parameter Types
    12. 5.12. Stack Frames
    13. 5.13. Recursion
    14. 5.14. Method Overloading
  11. 6. More About Classes
    1. 6.1. Class Members
      1. 6.1.1. Order of Member Modifiers
    2. 6.2. Instance Class Members
    3. 6.3. Static Fields
    4. 6.4. Accessing Static Members from Outside the Class
      1. 6.4.1. Example of a Static Field
      2. 6.4.2. Lifetimes of Static Members
    5. 6.5. Static Function Members
    6. 6.6. Other Static Class Member Types
    7. 6.7. Member Constants
      1. 6.7.1. Constants Are Like Statics
    8. 6.8. Properties
      1. 6.8.1. Property Declarations and Accessors
      2. 6.8.2. A Property Example
      3. 6.8.3. Using a Property
      4. 6.8.4. Properties and Associated Fields
      5. 6.8.5. Performing Other Calculations
      6. 6.8.6. Read-Only and Write-Only Properties
      7. 6.8.7. An Example of a Computed, Read-Only Property
      8. 6.8.8. Example of Properties and Databases
      9. 6.8.9. Automatically Implemented Properties
      10. 6.8.10. Static Properties
    9. 6.9. Instance Constructors
      1. 6.9.1. Constructors with Parameters
      2. 6.9.2. Default Constructors
    10. 6.10. Static Constructors
      1. 6.10.1. Example of a Static Constructor
      2. 6.10.2. Accessibility of Constructors
    11. 6.11. Object Initializers
    12. 6.12. Destructors
      1. 6.12.1. Calling the Destructor
      2. 6.12.2. The Standard Dispose Pattern
    13. 6.13. Comparing Constructors and Destructors
    14. 6.14. The readonly Modifier
    15. 6.15. The this Keyword
    16. 6.16. Indexers
      1. 6.16.1. What Is an Indexer?
      2. 6.16.2. Indexers and Properties
      3. 6.16.3. Declaring an Indexer
      4. 6.16.4. The set Accessor
      5. 6.16.5. The get Accessor
      6. 6.16.6. More About Indexers
      7. 6.16.7. Declaring the Indexer for the Employee Example
      8. 6.16.8. Another Indexer Example
      9. 6.16.9. Indexer Overloading
    17. 6.17. Access Modifiers on Accessors
    18. 6.18. Partial Classes and Partial Types
      1. 6.18.1. Partial Methods
  12. 7. Classes and Inheritance
    1. 7.1. Class Inheritance
    2. 7.2. Accessing the Inherited Members
      1. 7.2.1. All Classes Are Derived from Class object
    3. 7.3. Hiding Members of a Base Class
    4. 7.4. Base Access
    5. 7.5. Using References to a Base Class
      1. 7.5.1. Virtual and Override Methods
      2. 7.5.2. Overriding a Method Marked override
        1. 7.5.2.1. Case 1: Declaring Print with override
        2. 7.5.2.2. Case 2: Declaring Print with new
    6. 7.6. Constructor Execution
      1. 7.6.1. Constructor Initializers
      2. 7.6.2. Class Access Modifiers
    7. 7.7. Inheritance Between Assemblies
    8. 7.8. Member Access Modifiers
      1. 7.8.1. Regions Accessing a Member
      2. 7.8.2. Public Member Accessibility
      3. 7.8.3. Private Member Accessibility
      4. 7.8.4. Protected Member Accessibility
      5. 7.8.5. Internal Member Accessibility
      6. 7.8.6. Protected Internal Member Accessibility
      7. 7.8.7. Summary of Member Access Modifiers
    9. 7.9. Abstract Members
    10. 7.10. Abstract Classes
      1. 7.10.1. Example of an Abstract Class and an Abstract Method
    11. 7.11. Sealed Classes
    12. 7.12. Static Classes
    13. 7.13. Extension Methods
    14. 7.14. External Methods
  13. 8. Expressions and Operators
    1. 8.1. Expressions
    2. 8.2. Literals
    3. 8.3. Integer Literals
      1. 8.3.1. Real Literals
    4. 8.4. Character Literals
    5. 8.5. String Literals
    6. 8.6. Order of Evaluation
      1. 8.6.1. Precedence
      2. 8.6.2. Associativity
    7. 8.7. Simple Arithmetic Operators
    8. 8.8. The Remainder Operator
    9. 8.9. Relational and Equality Comparison Operators
      1. 8.9.1. Comparison and Equality Operations
    10. 8.10. Increment and Decrement Operators
    11. 8.11. Conditional Logical Operators
    12. 8.12. Logical Operators
    13. 8.13. Shift Operators
    14. 8.14. Assignment Operators
      1. 8.14.1. Compound Assignment
    15. 8.15. The Conditional Operator
    16. 8.16. Unary Arithmetic Operators
    17. 8.17. User-Defined Type Conversions
      1. 8.17.1. Explicit Conversion and the Cast Operator
    18. 8.18. Operator Overloading
      1. 8.18.1. Restrictions on Operator Overloading
      2. 8.18.2. Example of Operator Overloading
    19. 8.19. The typeof Operator
  14. 9. Statements
    1. 9.1. What Are Statements?
    2. 9.2. Expression Statements
    3. 9.3. Flow-of-Control Statements
    4. 9.4. The if Statement
    5. 9.5. The if . . . else Statement
    6. 9.6. The switch Statement
      1. 9.6.1. A Switch Example
      2. 9.6.2. More on the switch Statement
      3. 9.6.3. Switch Labels
    7. 9.7. The while Loop
    8. 9.8. The do Loop
    9. 9.9. The for Loop
      1. 9.9.1. The Scope of Variables in a for Statement
      2. 9.9.2. Multiple Expressions in the Initializer and Iteration Expression
    10. 9.10. Jump Statements
    11. 9.11. The break Statement
    12. 9.12. The continue Statement
    13. 9.13. Labeled Statements
      1. 9.13.1. Labels
      2. 9.13.2. The Scope of Labeled Statements
    14. 9.14. The goto Statement
      1. 9.14.1. The goto Statement Inside a switch Statement
    15. 9.15. The using Statement
      1. 9.15.1. Packaging Use of the Resource
      2. 9.15.2. Example of the using Statement
      3. 9.15.3. Multiple Resources and Nesting
      4. 9.15.4. Another Form of the using Statement
    16. 9.16. Other Statements
  15. 10. Namespaces and Assemblies
    1. 10.1. Referencing Other Assemblies
      1. 10.1.1. The mscorlib Library
    2. 10.2. Namespaces
      1. 10.2.1. Namespace Names
      2. 10.2.2. More About Namespaces
      3. 10.2.3. Namespaces Spread Across Files
      4. 10.2.4. Nesting Namespaces
    3. 10.3. The using Directives
      1. 10.3.1. The using Namespace Directive
      2. 10.3.2. The using Alias Directive
    4. 10.4. The Structure of an Assembly
    5. 10.5. The Identity of an Assembly
    6. 10.6. Strongly Named Assemblies
      1. 10.6.1. Creating a Strongly Named Assembly
    7. 10.7. Private Deployment of an Assembly
    8. 10.8. Shared Assemblies and the GAC
      1. 10.8.1. Installing Assemblies into the GAC
      2. 10.8.2. Side-by-Side Execution in the GAC
    9. 10.9. Configuration Files
    10. 10.10. Delayed Signing
  16. 11. Exceptions
    1. 11.1. What Are Exceptions?
    2. 11.2. The try Statement
      1. 11.2.1. Handling the Exception
    3. 11.3. The Exception Classes
    4. 11.4. The catch Clause
    5. 11.5. Examples Using Specific catch Clauses
    6. 11.6. The catch Clauses Section
    7. 11.7. The finally Block
    8. 11.8. Finding a Handler for an Exception
    9. 11.9. Searching Further
      1. 11.9.1. General Algorithm
      2. 11.9.2. Example of Searching Down the Call Stack
    10. 11.10. Throwing Exceptions
    11. 11.11. Throwing Without an Exception Object
  17. 12. Structs
    1. 12.1. What Are Structs?
    2. 12.2. Structs Are Value Types
    3. 12.3. Assigning to a Struct
    4. 12.4. Constructors and Destructors
      1. 12.4.1. Instance Constructors
      2. 12.4.2. Static Constructors
      3. 12.4.3. Summary of Constructors and Destructors
    5. 12.5. Field Initializers Are Not Allowed
    6. 12.6. Structs Are Sealed
    7. 12.7. Boxing and Unboxing
    8. 12.8. Structs As Return Values and Parameters
    9. 12.9. Additional Information About Structs
  18. 13. Enumerations
    1. 13.1. Enumerations
      1. 13.1.1. Setting the Underlying Type and Explicit Values
      2. 13.1.2. Implicit Member Numbering
    2. 13.2. Bit Flags
      1. 13.2.1. The Flags Attribute
      2. 13.2.2. Example Using Bit Flags
    3. 13.3. More About Enums
  19. 14. Arrays
    1. 14.1. Arrays
      1. 14.1.1. Definitions
      2. 14.1.2. Important Details
    2. 14.2. Types of Arrays
    3. 14.3. An Array As an Object
    4. 14.4. One-Dimensional and Rectangular Arrays
      1. 14.4.1. Declaring a One-Dimensional Array or a Rectangular Array
    5. 14.5. Instantiating a One-Dimensional or Rectangular Array
    6. 14.6. Accessing Array Elements
    7. 14.7. Initializing an Array
      1. 14.7.1. Explicit Initialization of One-Dimensional Arrays
      2. 14.7.2. Explicit Initialization of Rectangular Arrays
      3. 14.7.3. Syntax Points for Initializing Rectangular Arrays
      4. 14.7.4. Shortcut Syntax
      5. 14.7.5. Implicitly Typed Arrays
      6. 14.7.6. Putting It All Together
    8. 14.8. Jagged Arrays
      1. 14.8.1. Declaring a Jagged Array
      2. 14.8.2. Shortcut Instantiation
      3. 14.8.3. Instantiating a Jagged Array
      4. 14.8.4. Sub-Arrays in Jagged Arrays
    9. 14.9. Comparing Rectangular and Jagged Arrays
    10. 14.10. The foreach Statement
      1. 14.10.1. The Iteration Variable Is Read-Only
      2. 14.10.2. The foreach Statement with Multidimensional Arrays
        1. 14.10.2.1. Example with a Rectangular Array
        2. 14.10.2.2. Example with a Jagged Array
    11. 14.11. Array Covariance
    12. 14.12. Useful Inherited Array Members
      1. 14.12.1. The Clone Method
    13. 14.13. Comparing Array Types
  20. 15. Delegates
    1. 15.1. What Is a Delegate?
      1. 15.1.1. Methods in the Invocation List
    2. 15.2. Declaring the Delegate Type
    3. 15.3. Creating the Delegate Object
    4. 15.4. Assigning Delegates
    5. 15.5. Combining Delegates
    6. 15.6. Adding Methods to Delegates
    7. 15.7. Removing Methods from a Delegate
    8. 15.8. Invoking a Delegate
    9. 15.9. Delegate Example
    10. 15.10. Invoking Delegates with Return Values
    11. 15.11. Invoking Delegates with Reference Parameters
    12. 15.12. Anonymous Methods
      1. 15.12.1. Using Anonymous Methods
      2. 15.12.2. Syntax of Anonymous Methods
        1. 15.12.2.1. Return Type
        2. 15.12.2.2. Parameters
        3. 15.12.2.3. params Parameters
      3. 15.12.3. Scope of Variables and Parameters
        1. 15.12.3.1. Outer Variables
        2. 15.12.3.2. Extension of Captured Variable's Lifetime
    13. 15.13. Lambda Expressions
  21. 16. Events
    1. 16.1. Events Are Like Delegates
      1. 16.1.1. An Event Has a Private Delegate
    2. 16.2. Overview of Source Code Components
    3. 16.3. Declaring an Event
      1. 16.3.1. An Event Is a Member
      2. 16.3.2. The Delegate Type and EventHandler
    4. 16.4. Raising an Event
    5. 16.5. Subscribing to an Event
      1. 16.5.1. Removing Event Handlers
    6. 16.6. Standard Event Usage
      1. 16.6.1. Using the EventArgs Class
      2. 16.6.2. Passing Data by Extending EventArgs
      3. 16.6.3. Using the Custom Delegate
    7. 16.7. The MyTimerClass Code
    8. 16.8. Event Accessors
  22. 17. Interfaces
    1. 17.1. What Is an Interface?
      1. 17.1.1. Example Using the IComparable Interface
    2. 17.2. Declaring an Interface
    3. 17.3. Implementing an Interface
      1. 17.3.1. Example with a Simple Interface
    4. 17.4. An Interface Is a Reference Type
    5. 17.5. Using the as Operator with Interfaces
    6. 17.6. Implementing Multiple Interfaces
    7. 17.7. Implementing Interfaces with Duplicate Members
    8. 17.8. References to Multiple Interfaces
    9. 17.9. An Inherited Member As an Implementation
    10. 17.10. Explicit Interface Member Implementations
      1. 17.10.1. Accessing Explicit Interface Member Implementations
    11. 17.11. Interfaces Can Inherit Interfaces
      1. 17.11.1. Example of Different Classes Implementing an Interface
  23. 18. Conversions
    1. 18.1. What Are Conversions?
    2. 18.2. Implicit Conversions
    3. 18.3. Explicit Conversions and Casting
      1. 18.3.1. Casting
    4. 18.4. Types of Conversions
    5. 18.5. Numeric Conversions
      1. 18.5.1. Implicit Numeric Conversions
      2. 18.5.2. Overflow Checking Context
        1. 18.5.2.1. The checked and unchecked Operators
        2. 18.5.2.2. The checked and unchecked Statements
      3. 18.5.3. Explicit Numeric Conversions
        1. 18.5.3.1. Integral to Integral
        2. 18.5.3.2. float or double to Integral
        3. 18.5.3.3. decimal to Integral
        4. 18.5.3.4. double to float
        5. 18.5.3.5. float or double to decimal
        6. 18.5.3.6. decimal to float or double
    6. 18.6. Reference Conversions
      1. 18.6.1. Implicit Reference Conversions
      2. 18.6.2. Explicit Reference Conversions
      3. 18.6.3. Valid Explicit Reference Conversions
    7. 18.7. Boxing Conversions
      1. 18.7.1. Boxing Creates a Copy
        1. 18.7.1.1. The Boxing Conversions
    8. 18.8. Unboxing Conversions
      1. 18.8.1. The Unboxing Conversions
    9. 18.9. User-Defined Conversions
      1. 18.9.1. Constraints on User-Defined Conversions
      2. 18.9.2. Example of a User-Defined Conversion
      3. 18.9.3. Evaluating User-Defined Conversions
      4. 18.9.4. Example of a Multi-Step User-Defined Conversion
    10. 18.10. The is Operator
    11. 18.11. The as Operator
  24. 19. Generics
    1. 19.1. What Are Generics?
      1. 19.1.1. A Stack Example
    2. 19.2. Generics in C#
      1. 19.2.1. Continuing with the Stack Example
    3. 19.3. Generic Classes
    4. 19.4. Declaring a Generic Class
    5. 19.5. Creating a Constructed Type
    6. 19.6. Creating Variables and Instances
      1. 19.6.1. The Stack Example Using Generics
      2. 19.6.2. Comparing the Generic and Non-Generic Stack
    7. 19.7. Constraints on Type Parameters
      1. 19.7.1. Where Clauses
      2. 19.7.2. Constraint Types and Order
    8. 19.8. Generic Structs
    9. 19.9. Generic Interfaces
      1. 19.9.1. An Example Using Generic Interfaces
      2. 19.9.2. Generic Interface Implementations Must Be Unique
    10. 19.10. Generic Delegates
      1. 19.10.1. Another Generic Delegate Example
    11. 19.11. Generic Methods
      1. 19.11.1. Declaring a Generic Method
      2. 19.11.2. Invoking a Generic Method
        1. 19.11.2.1. Inferring Types
      3. 19.11.3. Example of a Generic Method
    12. 19.12. Extension Methods with Generic Classes
  25. 20. Enumerators and Iterators
    1. 20.1. Enumerators and Enumerable Types
      1. 20.1.1. Using the foreach Statement
      2. 20.1.2. Types of Enumerators
    2. 20.2. Using the IEnumerator Interface
      1. 20.2.1. Declaring an IEnumerator Enumerator
    3. 20.3. The IEnumerable Interface
      1. 20.3.1. Example Using IEnumerable and IEnumerator
    4. 20.4. The Non-Interface Enumerator
    5. 20.5. The Generic Enumeration Interfaces
    6. 20.6. The IEnumerator<T> Interface
    7. 20.7. The IEnumerable<T> Interface
    8. 20.8. Iterators
      1. 20.8.1. Iterator Blocks
      2. 20.8.2. Using an Iterator to Create an Enumerator
      3. 20.8.3. Using an Iterator to Create an Enumerable
    9. 20.9. Common Iterator Patterns
    10. 20.10. Producing Enumerables and Enumerators
    11. 20.11. Producing Multiple Enumerables
    12. 20.12. Producing Multiple Enumerators
    13. 20.13. Behind the Scenes with Iterators
  26. 21. Introduction to LINQ
    1. 21.1. What Is LINQ?
    2. 21.2. LINQ Providers
      1. 21.2.1. Anonymous Types
    3. 21.3. Query Syntax and Method Syntax
    4. 21.4. Query Variables
    5. 21.5. The Structure of Query Expressions
      1. 21.5.1. The from Clause
      2. 21.5.2. The join Clause
      3. 21.5.3. What Is a Join?
      4. 21.5.4. The from . . . let . . . where Section in the Query Body
        1. 21.5.4.1. The from Clause
        2. 21.5.4.2. The let Clause
        3. 21.5.4.3. The where Clause
      5. 21.5.5. The orderby Clause
      6. 21.5.6. The select . . . group Clause
      7. 21.5.7. Anonymous Types in Queries
      8. 21.5.8. The group Clause
      9. 21.5.9. Query Continuation
    6. 21.6. The Standard Query Operators
      1. 21.6.1. Query Expressions and the Standard Query Operators
      2. 21.6.2. Signatures of the Standard Query Operators
      3. 21.6.3. Delegates As Parameters
      4. 21.6.4. The LINQ Predefined Delegate Types
      5. 21.6.5. Example Using a Delegate Parameter
      6. 21.6.6. Example Using a Lambda Expression Parameter
    7. 21.7. LINQ to XML
      1. 21.7.1. Markup Languages
      2. 21.7.2. XML Basics
      3. 21.7.3. The XML Classes
        1. 21.7.3.1. Creating, Saving, Loading, and Displaying an XML Document
        2. 21.7.3.2. Creating an XML Tree
      4. 21.7.4. Using Values from the XML Tree
        1. 21.7.4.1. Adding Nodes and Manipulating XML
      5. 21.7.5. Working with XML Attributes
      6. 21.7.6. Other Types of Nodes
        1. 21.7.6.1. XComment
        2. 21.7.6.2. XDeclaration
        3. 21.7.6.3. XProcessingInstruction
      7. 21.7.7. Using LINQ Queries with LINQ to XML
  27. 22. Introduction to Asynchronous Programming
    1. 22.1. Processes, Threads, and Asynchronous Programming
      1. 22.1.1. Multithreading Considerations
      2. 22.1.2. The Complexity of Multithreading
    2. 22.2. Asynchronous Programming Patterns
    3. 22.3. BeginInvoke and EndInvoke
      1. 22.3.1. The Wait-Until-Done Pattern
      2. 22.3.2. The AsyncResult Class
      3. 22.3.3. The Polling Pattern
      4. 22.3.4. The Callback Pattern
        1. 22.3.4.1. The Callback Method
        2. 22.3.4.2. Calling EndInvoke Inside the Callback Method
    4. 22.4. Timers
  28. 23. Preprocessor Directives
    1. 23.1. What Are Preprocessor Directives?
    2. 23.2. General Rules
    3. 23.3. The #define and #undef Directives
    4. 23.4. Conditional Compilation
    5. 23.5. The Conditional Compilation Constructs
    6. 23.6. Diagnostic Directives
    7. 23.7. Line Number Directives
    8. 23.8. Region Directives
    9. 23.9. The #pragma warning Directive
  29. 24. Reflection and Attributes
    1. 24.1. Metadata and Reflection
    2. 24.2. The Type Class
    3. 24.3. Getting a Type Object
    4. 24.4. What Is an Attribute?
    5. 24.5. Applying an Attribute
    6. 24.6. Predefined, Reserved Attributes
      1. 24.6.1. The Obsolete Attribute
      2. 24.6.2. The Conditional Attribute
        1. 24.6.2.1. Example of the Conditional Attribute
      3. 24.6.3. Predefined Attributes
    7. 24.7. More About Applying Attributes
      1. 24.7.1. Multiple Attributes
      2. 24.7.2. Other Types of Targets
      3. 24.7.3. Global Attributes
    8. 24.8. Custom Attributes
      1. 24.8.1. Declaring a Custom Attribute
      2. 24.8.2. Using Attribute Constructors
      3. 24.8.3. Specifying the Constructor
      4. 24.8.4. Using the Constructor
      5. 24.8.5. Positional and Named Parameters in Constructors
      6. 24.8.6. Restricting the Usage of an Attribute
        1. 24.8.6.1. The Constructor for AttributeUsage
      7. 24.8.7. Suggested Practices for Custom Attributes
    9. 24.9. Accessing an Attribute
      1. 24.9.1. Using the IsDefined Method
      2. 24.9.2. Using the GetCustomAttributes Method
  30. 25. Other Topics
    1. 25.1. Overview
    2. 25.2. Strings
      1. 25.2.1. Using Class StringBuilder
      2. 25.2.2. Formatting Numeric Strings
        1. 25.2.2.1. The Alignment Specifier
        2. 25.2.2.2. The Format Component
        3. 25.2.2.3. Standard Numeric Format Specifiers
    3. 25.3. Parsing Strings to Data Values
    4. 25.4. Nullable Types
      1. 25.4.1. Creating a Nullable Type
      2. 25.4.2. Assigning to a Nullable Type
        1. 25.4.2.1. Using Operators and the Null Coalescing Operator
      3. 25.4.3. Using Nullable User-Defined Types
        1. 25.4.3.1. Nullable<T>
    5. 25.5. Method Main
      1. 25.5.1. Accessibility of Main
    6. 25.6. Documentation Comments
      1. 25.6.1. Inserting Documentation Comments
      2. 25.6.2. Using Other XML Tags
    7. 25.7. Nested Types
      1. 25.7.1. Example of a Nested Class
      2. 25.7.2. Visibility and Nested Types

Product information

  • Title: Illustrated C# 2008
  • Author(s): Daniel Solis
  • Release date: February 2008
  • Publisher(s): Apress
  • ISBN: 9781590599549