Programming Microsoft® Visual C#® 2008: The Language

Book description

Get the in-depth reference and pragmatic, real-world insights you need to exploit the enhanced language features and core capabilities in Visual C# 2008. Programming expert Donis Marshall deftly helps you build your proficiency with language features such as classes, structs, and other fundamentals, and helps you advance your expertise with more-advanced topics such as debugging, threading, and memory management. Combining an incisive reference with code samples and best practices, this developer reference focuses on details of the C# language you need to build innovative solutions.

Key Book Benefits:

Delves into the core, must-know topics for developers working with Visual C# 2008, and advances their mastery with essential skills

Thoroughly explicates language features such as generics, code snippets, and anonymous methods, while also providing updated information about classic features such as namespaces and metadata

Provides code samples to illustrate concepts and build skills mastery

Table of contents

  1. Programming Microsoft Visual C# 2008: The Language
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. Praise for Programming Microsoft Visual C# 2005: The Language (Microsoft Press)
    3. Acknowledgments
    4. 1. Introduction
      1. Who Is This Book For?
      2. Organization of This Book
      3. System Requirements
      4. Technology Updates
        1. Find Additional Content Online
        2. The Companion Web Site
        3. Support for This Book
    5. I. Core Language
      1. 1. Introduction to Microsoft Visual C# Programming
        1. A Demonstration of Visual C# 2008
          1. Sample C# Program
          2. Sample LINQ Program
        2. Common Elements in Visual C# 2008
          1. Namespaces
          2. Main Entry Point
          3. Local Variables
          4. Nullable Types
          5. Expressions
          6. Selection Statements
          7. Iterative Statements
        3. C# Core Language Features
          1. Symbols and Tokens
            1. White Space
            2. Tabs
            3. Punctuators
              1. Semicolon punctuator
              2. Dot punctuator
              3. Colon punctuator
              4. Comma punctuator
            4. Line Terminators
            5. Comments
              1. Single-line comments: //
              2. Delimited comments: /* and */
              3. Single-line documentation comments: ///
              4. Multi-line documentation tags
            6. Preprocessor Directives
              1. Declarative preprocessor directives
              2. Conditional preprocessor directives
              3. Diagnostic directives
              4. Pragma directives
              5. Region directives
              6. Line directives
            7. Blocks
            8. Generic types
            9. Characters
            10. Numeric Suffixes
            11. Escape Characters
            12. Verbatim Characters
            13. Operators
              1. Unary operators
              2. Binary operators
              3. Compound operators
              4. Boolean operators
              5. Ternary operators
              6. Type operators
              7. Pointer operators
              8. Miscellaneous operators
          2. Identifiers
          3. Keywords
          4. Primitives
        4. Types
      2. 2. Types
        1. Classes
          1. Class Members
            1. Member Accessibility
            2. Member Attributes
            3. Member Modifiers
            4. Instance and Static Members
              1. Static class
            5. this Object
            6. Data and Function Members
            7. Constants
            8. Fields
          2. Member Functions
            1. Functions
              1. Function Return
              2. Function parameters
            2. Function Overloading
            3. Local Variables
              1. Visibility
            4. Methods
            5. Constructors
              1. Singleton
              2. Object initializers
            6. Destructors
            7. Properties
              1. Read-only and write-only properties
              2. Automatically implemented properties
              3. Error handling
            8. Nested Types
            9. Partial Type
            10. Partial Method
        2. Structures
        3. Enumeration
          1. Bitwise Enumeration
        4. Equivalence versus Identity
        5. Class Refinement
      3. 3. Inheritance
        1. Inheritance Example
          1. Cross-Language Inheritance
        2. System.Object
          1. Object.Equals Method
          2. Object.GetHashCode Method
          3. Object.GetType Method
          4. Object.ToString Method
          5. Object.MemberwiseClone Method
          6. Object.ReferenceEquals Method
        3. Employee Class
        4. Implementing Inheritance
          1. Accessibility
        5. Overriding Inherited Behavior
          1. Virtual and Override Keywords
          2. Overload versus Override
          3. Overriding Events
          4. Extension Method
        6. The new Modifier
        7. Abstract Classes
        8. Sealed Classes
        9. Constructors and Destructors
        10. Interfaces
          1. Implementing Interfaces
          2. Explicit Interface Member Implementation
          3. Reimplementation of Interfaces
        11. Polymorphism
          1. Interface Polymorphism
          2. The new Modifier and Polymorphism
        12. Casting
          1. Type Operators
        13. Attribute Inheritance
        14. Visual Studio 2008
    6. II. Core Skills
      1. 4. Introduction to Visual Studio 2008
        1. Migrating to Visual Studio 2008
        2. Integrated Development Environment
          1. Start Page
          2. Creating Projects
          3. Multiple-Targeting
          4. Solution Explorer
            1. Project Types
          5. Adding References
          6. Managing Windows in Visual Studio
          7. AutoRecover
        3. Class Hierarchies
          1. Class View Window
          2. Object Browser
          3. Class Diagram
            1. Class Details
            2. Class Diagram Toolbox
          4. Inheritance
          5. Association
          6. A Class Diagram Example
          7. Error List Window
        4. Code Editor
          1. IntelliSense
          2. Surround With
          3. Font and Color Formatting
          4. Source Code Formatting
          5. Change Tracking
        5. Code Snippets
          1. Insert a Code Snippet
          2. Default Snippets
          3. Code Snippets Manager
          4. Creating Snippets
            1. CodeSnippets and CodeSnippet Elements
            2. Header Element
            3. Snippet, References, and Imports Elements
            4. Declarations, Literal, and Object Elements
            5. Code and <![CDATA ]> Elements
            6. String Builder Code Snippet
            7. Code Snippet Creation Example
          5. Copy and Paste
        6. Refactoring
          1. Refactoring Example
        7. Building and Deployment
          1. MSBuild
            1. Items
            2. Properties
            3. Tasks
            4. Project File
            5. MSBuild Example
          2. ClickOnce Deployment
            1. Publish a ClickOnce Application
        8. Arrays and Collections
      2. 5. Arrays and Collections
        1. Arrays
          1. Array Elements
          2. Multidimensional Arrays
          3. Jagged Arrays
          4. System.Array
            1. Array.AsReadOnly Method
            2. Array.Clone Method
            3. Array.CreateInstance Method
            4. System.Array and Predicates
            5. Array.Resize Method
          5. System.Array Properties
            1. Array.SyncRoot Property
            2. Comparable Elements
            3. ICollection Interface
            4. ICloneable Interface
            5. IEnumerable
            6. IList Interface
            7. Indexers
          6. params Keyword
          7. Array Conversion
            1. Arrays as Function Returns and Parameters
        2. Collections
          1. ArrayList Collection
          2. BitArray Collection
          3. Hashtable Collection
          4. Queue Collection
            1. SortedList
          5. Stack Collection
          6. Specialized Collections
        3. LINQ
      3. 6. Introduction to LINQ
        1. C# Extensions
          1. Type Inference
          2. Object Initializers
          3. Anonymous Types
          4. Extension Methods
          5. Lambda Expression
          6. Expression Trees
        2. LINQ Essentials
          1. Core Elements
          2. Conversion Operators
          3. LINQ Query Expression Syntax
          4. Where Is LINQ?
            1. Namespaces
        3. LINQ to Objects
          1. Examples of LINQ to Objects
            1. Declarative versus Imperative
            2. LINQ to Objects Reduces Complexity
            3. LINQ to Objects and Cross-Domain Access
        4. LINQ Operators
          1. Aggregation Operators
          2. Concatenation Operator
          3. Data Type Conversion Operators
          4. Element Operators
          5. Equality Operator
          6. Filtering Operator
          7. Generation Operators
          8. Grouping Operator
          9. Join Operators
          10. Partitioning Operators
          11. Quantifier Operators
          12. Set Operators
          13. Sorting Operators
        5. Generics
      4. 7. Generics
        1. Generic Types
          1. Type Parameters
          2. Type Arguments
          3. Constructed Types
          4. Overloaded Methods
        2. Generic Methods
          1. The this Reference for Generic Types
        3. Constraints
          1. Derivation Constraints
          2. Interface Constraints
          3. Value Type Constraints
          4. Reference Type Constraints
          5. Default Constructor Constraints
        4. Casting
        5. Inheritance
          1. Overriding Generic Methods
          2. Nested Types
        6. Static Members
          1. Operator Functions
          2. Serialization
          3. Generics Internals
          4. Generic Collections
        7. Enumerators
      5. 8. Enumerators
        1. Enumerable Objects
          1. Enumerators
            1. Enumerator states
          2. An Enumerator Example
          3. An Enumerator Example (Versioned Collection)
          4. IEnumerator Problem
        2. Generic Enumerators
          1. IEnumerable<T> Interface
          2. IEnumerator<T> Interface
          3. A Generic Enumerator Example (Versioned Collection)
        3. Iterators
          1. Yield Statement
          2. Iterator Blocks
          3. Iterator Internals
          4. Iterator Examples
            1. Dual iteration
            2. Reverse iteration
            3. Temporary collections
            4. Complex iteration
        4. Operator Overloading
    7. III. More C# Language
      1. 9. Operator Overloading
        1. Mathematical and Logical Operators
          1. Implementation
          2. Increment and Decrement Operators
          3. LeftShift and RightShift Operators
          4. Operator True and Operator False
          5. Paired Operators
          6. Operator== and Operator!=
          7. Operator| and Operator&
          8. Operator|| and Operator&&
        2. Conversion Operators
          1. The Operator String Operator
        3. A Practical Example
        4. Operator Overloading Internals
        5. Delegates and Events
      2. 10. Delegates and Events
        1. Delegates
          1. Defining a Delegate
          2. Creating a Delegate
            1. Contravariance and Covariance
          3. Invoking a Delegate
          4. Arrays of Delegates
            1. System.MulticastDelegate Class
              1. Combining delegates
              2. Removing delegates
            2. Invocation List
              1. Methods and properties
            3. Generics and Delegates
          5. Asynchronous Invocation
            1. BeginInvoke Method
            2. EndInvoke Method
          6. Asynchronous Delegate Diagram
            1. Delegate Internals
          7. Exceptions
        2. Anonymous Methods
          1. Outer Variables
          2. Generic Anonymous Methods
          3. Limitations of Anonymous Methods
        3. Events
          1. Publishing an Event
          2. Subscribers
          3. Raising an Event
            1. EventArgs
        4. LINQ Programming
      3. 11. LINQ Programming
        1. LINQ to XML
          1. XML Schemas
          2. Validation
          3. Navigation
            1. Explicit Casting
          4. XML Modification
          5. XML Query Expressions
        2. LINQ to SQL
          1. Entity Classes
          2. LINQ to SQL Query Expression
            1. LINQ to DataSet
          3. Associations
          4. LINQ to SQL Updates
          5. Exception Handling
      4. 12. Exception Handling
        1. An Exception Example
        2. A Standard Exception Model
        3. Structured Exception Handling
          1. Try Statements
          2. Catch Statements
            1. Propagating Exceptions
          3. Finally Statements
          4. Exception Information Table
          5. Nested Try Blocks
        4. System.Exception
          1. System.Exception Functions
          2. System.Exception Properties
          3. Application Exceptions
          4. Exception Translation
          5. COM Interoperability Exceptions
            1. COM Exceptions
            2. Generating COM Exceptions
        5. Remote Exceptions
        6. Unhandled Exceptions
          1. Application.ThreadException
          2. AppDomain.UnhandledException
        7. Managing Exceptions in Visual Studio
          1. The Exception Assistant
          2. The Exceptions Dialog Box
        8. Metadata and Reflection
    8. IV. Debugging
      1. 13. Metadata and Reflection
        1. Metadata
          1. Metadata Tokens
          2. Metadata Heaps
          3. Streams
          4. Metadata Validation
          5. ILDASM
        2. Reflection
          1. Obtaining a Type Object
          2. Loading Assemblies
          3. Browsing Type Information
          4. Dynamic Invocation
            1. Binders
          5. Type Creation
          6. Late Binding Delegates
          7. Function Call Performance
        3. Reflection and Generics
          1. IsGeneric and IsGenericTypeDefinition
          2. typeof
          3. GetType
          4. GetGenericTypeDefinition
          5. GetGenericArguments
          6. Creating Generic Types
          7. Reflection Security
          8. Attributes
            1. Predefined Custom Attributes
            2. Pseudo-custom Attributes
            3. Combining Attributes
            4. Anatomy of an Attribute
          9. Programmer-Defined Custom Attributes
          10. Attributes and Reflection
        4. MSIL
      2. 14. MSIL Programming
        1. "Hello World" Application
        2. Evaluation Stack
        3. MSIL in Depth
          1. Directives
            1. Assembly Directives
              1. .assembly
              2. .assembly extern
              3. .file
              4. .subsystem
              5. .corflags
              6. .stackreserve
              7. .imagebase
            2. Class Directives
              1. .class header {members}
              2. .custom constructorsignature
              3. .method
              4. .field
              5. .property
              6. .event
            3. Method Directives
              1. .locals
              2. .maxstack
              3. .entrypoint
            4. Method Directive Example
            5. MSIL Instructions
              1. Short Form
            6. Load and Store Methods
        4. Complex Tasks
          1. Managing Types
            1. Boxing
            2. Inheritance
            3. Interfaces
              1. Structures
        5. Branching
          1. Calling Methods
            1. call
            2. callvirt
            3. calli
            4. jmp
            5. tail
        6. Arrays
        7. Arithmetic Instructions
        8. Conversion Operations
        9. Exception Handling
        10. Miscellaneous Operations
        11. Process Execution
          1. Roundtripping
        12. Debugging with Visual Studio 2008
      3. 15. Debugging with Visual Studio 2008
        1. Debugging Overview
          1. Debugging Windows Forms Projects
          2. Attaching to a Running Process
          3. Debugging Console Application Projects
          4. Debugging Class Library Projects
        2. Debug Setup
          1. Debug and Release Configurations
          2. Configuration Manager
        3. Debug Settings
          1. Visual Studio Environment Debug Settings
            1. General Options
            2. Edit And Continue Options
            3. Just-In-Time Options
            4. Native Options
            5. Symbols Options
          2. Debug Settings for a Solution
          3. Debug Settings for a Project
        4. Breakpoints
          1. Function Breakpoints
          2. Breakpoints Window
            1. Location
            2. Condition
            3. Hit Count
            4. Filter
            5. When Hit Command
          3. Trace Points
            1. Breakpoint Symbols
        5. Code Stepping
          1. Step Commands
          2. Example of Setting The Next Statement
        6. Debug Toolbar
        7. Data Tips
          1. Visualizers
        8. Debug Windows
          1. Breakpoints Window
          2. Output Window
          3. Watch Window and Other Variables Windows
            1. Expressions
            2. Expression example
          4. Autos Window
          5. Locals Window
          6. Immediate Window
          7. Call Stack Window
          8. Threads Window
          9. Modules Window
            1. Processes Window
          10. Memory Window
          11. Disassembly Window
          12. Registers Window
        9. Tracing
          1. Tracing Example
          2. Configuration File
            1. The sources Element
            2. The listeners Element
            3. The sharedListeners Element
            4. The switches Element
          3. Tracing Example with a Configuration File
        10. DebuggerDisplayAttribute
        11. DebuggerBrowsableAttribute
        12. DebuggerTypeProxyAttribute
        13. Dump Files
        14. Advanced Debugging
      4. 16. Advanced Debugging
        1. DebuggableAttribute Attribute
        2. Debuggers
        3. Managed Debugger (MDbg)
          1. MDbg Example
          2. MDbg Commands
        4. WinDbg
          1. Basic WinDbg Commands
            1. Stack Trace Commands
            2. Display Memory Commands
            3. Breakpoint Memory Commands
            4. Step Commands
              1. WinDbg Directives
        5. Son of Strike (SOS)
          1. SOS Example, Part I
            1. SOS Commands
          2. SOS Example, Part II
        6. Dumps
          1. ADPlus
            1. An ADPlus Example
        7. Memory Management
          1. Object graph
            1. Memory Example
          2. Generations
            1. Generations Example
          3. Finalization
          4. Reliability and Performance Monitor
        8. Threads
          1. Threads Commands
            1. Threads Example
            2. Threads Example #2
        9. Exceptions
          1. Exception Example
        10. Symbols
          1. Symsrv Symbol Server
          2. Application Symbols
            1. WinDbg
        11. Memory Management
    9. V. Advanced Features
      1. 17. Memory Management
        1. Unmanaged Resources
          1. Garbage Collection Overview
          2. GC Flavors
            1. Workstation GC with Concurrent Garbage Collection
            2. Workstation GC Without Concurrent Garbage Collection
            3. Server GC
            4. Configuring GC Flavor
        2. Finalizers
          1. Finalizer Thread
          2. Finalizer Considerations
            1. High expense of finalizers
            2. Lack of guarantee
            3. Multithreading
            4. One finalizer thread
            5. Finalizers and virtual functions
            6. Unpredictable order of finalization
            7. Resurrection
            8. Finalizers and reentrancy
            9. Deep object graphs
            10. Finalizer race conditions
            11. Constructors
            12. The Console class and finalization
        3. IDisposable.Dispose
          1. TLS Example
          2. Disposable Pattern
          3. Disposable Pattern Considerations
            1. Redundant Dispose Method
            2. Close Method
            3. Thread-Safe Dispose Method
            4. Reusable Objects
          4. Disposing Inner Objects
        4. Weak Reference
          1. Weak Reference Internals
          2. WeakReference Class
          3. Reliable Code
            1. Constrained Execution Region
            2. Critical Finalizer Class
            3. Safe Handles
          4. Managing Unmanaged Resources
            1. Memory Pressure
            2. Handles
        5. The GC Class
        6. Unsafe Code
      2. 18. Unsafe Code
        1. Unsafe Keyword
          1. Pointers
          2. Pointer Parameters and Pointer Return Values
            1. Fixed Statements
            2. The stackalloc Command
          3. P/Invoke
            1. Interop Marshaler
            2. DllImport
              1. EntryPoint
              2. CallingConvention
              3. ExactSpelling
              4. PreserveSig
              5. SetLastError
              6. CharSet
              7. BestFitMapping
              8. ThrowOnUnmappableChar
            3. Blittable Types
            4. Formatted Type
            5. Directional Attributes
            6. StringBuilder
            7. Unmanaged Callbacks
            8. Explicit Marshaling
            9. Fixed-Size Buffers
        2. Summary
    10. A. About the Author
    11. B. Additional Resources for Developers from Microsoft Press
      1. Visual Basic
      2. Visual C#
      3. Web Development
      4. Data Access
      5. .NET Framework
      6. Other Developer Topics
    12. C. More Great Developer Resources
      1. Developer Step by Step
      2. Developer Reference
      3. Focused Topics
    13. Index
    14. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Programming Microsoft® Visual C#® 2008: The Language
  • Author(s):
  • Release date: June 2008
  • Publisher(s): Microsoft Press
  • ISBN: 9780735625402