Programming Microsoft® Visual C#® 2005: The Language

Book description

This CORE REFERENCE provides essential insights and practical code samples to develop your proficiency with the language features and capabilities in Visual C# 2005.

Table of contents

  1. Programming Microsoft® Visual C#® 2005: The Language
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Praise for Programming Microsoft Visual C# 2005: The Language
  5. Acknowledgments
  6. Introduction
    1. Who Is This Book For?
    2. Organization of This Book
    3. System Requirements
    4. Technology Updates
    5. Code Samples
    6. Support for This Book
      1. Questions and Comments
    7. Microsoft Press Online: Resources for Microsoft Visual Studio 2005
  7. I. Core Language
    1. 1. Introduction to Visual C# Programming
      1. Language Origin
      2. 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. Delimited documentation tags
          6. Preprocessor Directives
            1. Declarative preprocessor directives
            2. Conditional preprocessor directives
            3. Diagnostic directives
            4. Region directives
            5. Line directives
          7. Blocks
          8. Generic Types
          9. Nullable Types
          10. Characters
          11. Numeric Suffixes
          12. Escape Characters
          13. Verbatim Characters
          14. Operators
            1. Unary operators
            2. Binary operators
            3. Compound operators
            4. Boolean operators
            5. Ternary operators
            6. Pointer operators
          15. Identifiers
        2. Keywords
        3. Primitives
      3. Sample C# Program
      4. Namespaces
      5. Main Entry Point
      6. Local Variables
      7. Nullable Types
      8. Expressions
      9. Selection Statements
      10. Iterative Statements
      11. Classes
    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
          9. Volatile Fields
        2. Member Functions
          1. Function Code
          2. Local Variables
            1. Scope
          3. Methods
            1. Method Return
            2. Function parameters
          4. Function Overloading
          5. Constructors
            1. Singleton
          6. Destructors
          7. Properties
            1. Read-only and write-only properties
            2. Error handling
          8. Nested Types
          9. Partial Classes
      2. Structures
      3. Enumeration
        1. Bitwise Enumeration
      4. Identity versus Equivalence
      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. Access Modifiers
      5. Overriding
        1. Virtual and Override Keywords
        2. Overload versus Override
        3. Overriding Events
      6. New Modifier
      7. Abstract
      8. Sealed
      9. Constructors and Destructors
      10. Interfaces
        1. Implementing Interfaces
        2. Explicit Interface Member Implementation
        3. Reimplementation of Interfaces
      11. Polymorphism
        1. Interface Polymorphism
        2. New Modifier and Polymorphism
      12. Casting
        1. Inheritance Operators
      13. Attribute Inheritance
      14. Visual Studio .NET 2005
  8. II. Core Skills
    1. 4. Introduction to Visual Studio 2005
      1. Integrated Development Environment
        1. Start Page
        2. Community Integration
        3. Creating Projects
        4. Solution Explorer
          1. Project Types
        5. Adding References
        6. Data Menu
        7. Managing Windows in Visual Studio
        8. AutoRecover
      2. Class Hierarchies
        1. Class View Window
        2. Object Browser
        3. Class Diagram
          1. Class Diagram Toolbox
        4. Inheritance
        5. Association
        6. Class Diagram Walkthrough
        7. Error List Window
      3. Code Editor
        1. IntelliSense
          1. Add using
        2. Surround With
        3. Font and Color Formatting
        4. Source Code Formatting
        5. Change Tracking
        6. Profile
      4. Code Snippets
        1. Copy and Paste
        2. Insert a Code Snippet
        3. Default Snippets
        4. Code Snippets Manager
        5. 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. Create a Code Snippet Walkthrough
      5. Refactoring
        1. Refactoring Walkthrough
      6. Building and Deployment
      7. MSBuild
        1. Items
        2. Properties
        3. Tasks
        4. Project File
        5. MSBuild Walkthrough
      8. Click Once Deployment
        1. Publish a ClickOnce Application
      9. 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. Array.FindAll Method
          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. Generics
    3. 6. Generics
      1. Generic Types
        1. Type Parameters
        2. Constructed Types
      2. Generic Methods
        1. Overloaded Methods
        2. This Reference for Generic Types
      3. Constraints
        1. Derivation Constraint
        2. Interface Constraints
        3. Value Type Constraint
        4. Reference Type Constraint
        5. Default Constructor Constraint
      4. Casting
      5. Inheritance
        1. Overriding Methods
        2. Nested Types
      6. Static Members
        1. Operator Functions
        2. Serialization
        3. Generics Internals
        4. Generic Collections
      7. Enumerators
    4. 7. Iterators
      1. Enumerable Objects
        1. Enumerators
          1. Enumerator states
        2. Enumerator Example
        3. Enumerator Example (Static Collection)
        4. Enumerator Example (Versioned Collection)
        5. IEnumerator Problem
      2. Generic Enumerators
        1. IEnumerable<T> Interface
        2. IEnumerator<T> Interface
        3. 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. Delegates and Events
  9. III. More C# Language
    1. 8. Delegates and Events
      1. Delegates
        1. Define a Delegate
        2. Create 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. Subscribe
        3. Raising an Event
          1. EventArgs
      4. Exception Handling
    2. 9. Exception Handling
      1. Exception Example
      2. Common Exception Model
      3. Structured Exception Handling
        1. Try Statement
        2. Catch Statement
          1. Propagating Exceptions
        3. Finally Statement
        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. Exception Assistant
        2. Exceptions Dialog Box
      8. Metadata and Reflections
  10. IV. Debugging
    1. 10. Metadata and Reflection
      1. Metadata
        1. Tokens
        2. Metadata Heaps
        3. Streams
        4. Metadata Validation
        5. ILDASM Tool
      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 Attributes
          2. Combining Attributes
          3. Programmer-defined Custom Attributes
          4. Pseudo-custom Attributes
          5. Anatomy of an Attribute
        9. Creating a Custom Attribute
        10. Attributes and Reflection
      4. MSIL
    2. 11. MSIL Programming
      1. "Hello World" Application
      2. Evaluation Stack
      3. MSIL in Depth
        1. Directives
        2. Assembly Directives
        3. Class Directives
        4. Method Directives
        5. MSIL Instructions
          1. Short Form
          2. Load and Store Methods
      4. Complex Tasks
        1. Managing Types
          1. Boxing
          2. Inheritance
          3. Interfaces
          4. Structures
      5. Branching
        1. Calling Methods
      6. Arrays
      7. Arithmetic Instructions
        1. Conversion Operations
        2. Exception Handling
        3. Miscellaneous Operations
      8. Process Execution
        1. Roundtripping
      9. Debugging with Visual Studio 2005
    3. 12. Debugging with Visual Studio 2005
      1. Debugging Overview
        1. Debugging Windows Forms Projects
          1. Attaching to a Running Process
          2. Debugging Console Application Projects
          3. Debugging Class Library Projects
        2. Debugging Setup
          1. Debug and Release Configurations
          2. Configuration Manager
        3. Debug Settings
          1. Visual Studio Environment Debug Settings
            1. General window
            2. Edit And Continue window
            3. Just-In-Time Debugging window
            4. Native window
            5. Symbols window
          2. Debug Settings for a Solution
          3. Debug Settings for a Project
        4. Visual Studio Debugging User Interface
          1. Data Tips
          2. Visualizers
        5. Breakpoints
          1. Function Breakpoints
          2. Breakpoints Window
            1. Location
            2. Condition
            3. Hit Count
            4. Filter
            5. When Hit
          3. Tracepoints
          4. Breakpoint Symbols
        6. Code Stepping
          1. Step Commands
          2. Set The Next Statement Walkthrough
        7. Debug Toolbar
        8. Debug Windows
          1. Breakpoints Window
          2. Output Window
          3. Script Explorer Window
          4. Watch Window
            1. Expressions
            2. Expression walkthrough
          5. Autos Window
          6. Locals Window
          7. Immediate Window
          8. Call Stack Window
          9. Threads Window
          10. Modules Window
          11. Processes Window
          12. Memory Window
          13. Disassembly Window
          14. Registers Window
        9. Tracing
          1. Tracing Example
          2. Configuration File
            1. Sources element
            2. Listeners element
            3. sharedListeners element
            4. Switches element
          3. Tracing Example with a Configuration File
        10. DebuggerDisplayAttribute
          1. DebuggerBrowsableAttribute
          2. DebuggerTypeProxyAttribute
        11. Dump Files
      2. Advanced Debugging
    4. 13. Advanced Debugging
      1. DebuggableAttribute Attribute
      2. Debuggers
      3. Just-In-Time (JIT) Debugging
      4. Managed Debugger
        1. MDbg Walkthrough
        2. MDbg Commands
      5. WinDbg
        1. WinDbg Basic Commands
          1. Stack Trace Commands
          2. Display Memory Commands
          3. Breakpoints Memory Commands
          4. Step Commands
            1. WinDbg Directives
      6. Son of Strike (SOS)
        1. SOS Walkthrough Part I
          1. SOS Commands
        2. SOS Walkthrough Part II
      7. Dumps
        1. ADPlus
          1. ADPlus Walkthrough
        2. Dr. Watson
          1. Dr. Watson Walkthrough
      8. Memory Management
        1. Reference Tree
          1. Memory Walkthrough
        2. Generations
          1. Generations Walkthrough
        3. Finalization
        4. Performance Monitor
      9. Threads
        1. Threads Commands
          1. Threads Walkthrough
          2. Threads Walkthrough 2
      10. Exceptions
        1. Exception Walkthrough
      11. Symbols
        1. Symsrv Symbol Server
        2. Application Symbols
          1. WinDbg
      12. Memory Management
  11. V. Advanced Concepts
    1. 14. Memory Management
      1. Unmanaged Resources
        1. Garbage Collection Overview
        2. GC Flavors
          1. Workstation GC with Concurrent Garbage Collection
        3. Workstation GC Without Concurrent Garbage Collection
        4. Server GC
          1. Configuring GC Flavor
      2. Finalizers
        1. Finalizer Thread
        2. Finalizer Considerations
          1. Finalizers are expensive
          2. Finalizers are not guaranteed
          3. Multithreading
          4. One finalizer thread
          5. Finalizers and virtual functions
          6. Order of finalization
          7. Resurrection
          8. Finalizers and reentrancy
          9. Deep object graph
          10. Finalizer race condition
          11. Constructors
          12. Console and finalization
      3. IDisposable.Dispose
        1. Thread Local Storage 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. Weak Reference Class
        3. Critical Finalization Objects
        4. Constrained Execution Region
          1. Safe Handles
        5. Managing Unmanaged Resources
          1. Memory Pressure
          2. Handles
      5. GC Class
      6. Nonsecure Code
    2. 15. Unsafe Code
      1. Unsafe Keyword
        1. Pointers
        2. Pointer Parameters and Return
          1. Fixed
          2. stackalloc
        3. Platform Invoke
          1. Interop Marshaler
          2. DllImport
            1. EntryPoint
            2. CallingConvention
            3. ExactSpelling
            4. PreserveSig
            5. SetLastError
          3. CharSet
            1. BestFitMapping
            2. ThrowOnUnmappableChar
          4. Blittable Types
          5. Formatted Type
          6. Directional Attributes
          7. StringBuilder
          8. Unmanaged Callbacks
          9. Explicit Marshaling
          10. Fixed-Size Buffers
      2. Summary
  12. A. 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
        1. Operator== and Operator!=
        2. Operator|| and Operator&&
    2. Conversion Operators
      1. Operator String
    3. Practical Example
    4. Operator Overloading Internals
  13. B. Donis Marshall
  14. Index
  15. About the Author
  16. Copyright

Product information

  • Title: Programming Microsoft® Visual C#® 2005: The Language
  • Author(s):
  • Release date: January 2006
  • Publisher(s): Microsoft Press
  • ISBN: 9780735621817