Beginning Microsoft® Visual C#® 2008

Book description

The book is aimed at novice programmers who wish to learn programming with C# and the .NET framework. The book starts with absolute programming basics. It then moves into Web and Windows programming, data access (databases and XML), and more advanced technologies such as graphics programming with GDI+ and basic networking. The book is divided into sections including:

  • The C# Language: Basic language skills using console application. Content moves from the absolute basics to fairly involved OOP skills.

  • Windows Vista Programming: Using basic Windows applications, reinforcing earlier OOP and debugging skills.

  • Web Programming: Putting together basic Web applications, highlighting differences between Web and Windows programming.

  • Data Access: Accessing all kinds of data sources from Web and Windows applications, including SQL usage, XML, file system data, and Web Services.

  • Additional Techniques: "The fun stuff", including Windows Presentation Foundation, Windows Workflow, Windows Communication Foundation, GDI+, networking, Windows Services, and so on.

The book makes complicated subjects seem easy to learn, and it inspires readers to investigate areas further on their own by providing references to additional material, and exercise questions that require significant effort and personal research to complete.

Table of contents

  1. Copyright
  2. About the Authors
  3. Credits
  4. Introduction
    1. Who This Book Is For
    2. How This Book Is Structured
      1. The C# Language (Chapters 1-14)
      2. Windows Programming (Chapters 15-18)
      3. Web Programming (Chapters 19-23)
      4. Data Access (Chapters 24-29)
      5. Additional Techniques (Chapters 30-36)
    3. What You Need to Use This Book
    4. Conventions
    5. Source Code
    6. Errata
    7. p2p.wrox.com
  5. I. The C# Language
    1. 1. Introducing C#
      1. 1.1. What Is the .NET Framework?
        1. 1.1.1. What's in the .NET Framework?
        2. 1.1.2. Writing Applications Using the .NET Framework
          1. 1.1.2.1. MSIL and JIT
          2. 1.1.2.2. Assemblies
          3. 1.1.2.3. Managed Code
          4. 1.1.2.4. Garbage Collection
          5. 1.1.2.5. Fitting It Together
          6. 1.1.2.6. Linking
      2. 1.2. What Is C#?
        1. 1.2.1. Applications You Can Write with C#
        2. 1.2.2. C# in This Book
      3. 1.3. Visual Studio 2008
        1. 1.3.1. Visual Studio 2008 Express Products
        2. 1.3.2. Solutions
      4. 1.4. Summary
    2. 2. Writing a C# Program
      1. 2.1. The Development Environments
        1. 2.1.1. Visual Studio 2008
        2. 2.1.2. Visual C# 2008 Express Edition
      2. 2.2. Console Applications
        1. 2.2.1. The Solution Explorer
        2. 2.2.2. The Properties Window
        3. 2.2.3. The Error List Window
      3. 2.3. Windows Forms Applications
      4. 2.4. Summary
    3. 3. Variables and Expressions
      1. 3.1. Basic C# Syntax
      2. 3.2. Basic C# Console Application Structure
      3. 3.3. Variables
        1. 3.3.1. Simple Types
        2. 3.3.2. Variable Naming
          1. 3.3.2.1. Naming Conventions
        3. 3.3.3. Literal Values
          1. 3.3.3.1. String Literals
        4. 3.3.4. Variable Declaration and Assignment
      4. 3.4. Expressions
        1. 3.4.1. Mathematical Operators
        2. 3.4.2. Assignment Operators
        3. 3.4.3. Operator Precedence
        4. 3.4.4. Namespaces
      5. 3.5. Summary
      6. 3.6. Exercises
    4. 4. Flow Control
      1. 4.1. Boolean Logic
        1. 4.1.1. Bitwise Operators
        2. 4.1.2. Boolean Assignment Operators
        3. 4.1.3. Operator Precedence Updated
      2. 4.2. The goto Statement
      3. 4.3. Branching
        1. 4.3.1. The Ternary Operator
        2. 4.3.2. The if Statement
          1. 4.3.2.1. Checking More Conditions Using if Statements
        3. 4.3.3. The switch Statement
      4. 4.4. Looping
        1. 4.4.1. do Loops
        2. 4.4.2. while Loops
        3. 4.4.3. for Loops
        4. 4.4.4. Interrupting Loops
        5. 4.4.5. Infinite Loops
      5. 4.5. Summary
      6. 4.6. Exercises
    5. 5. More About Variables
      1. 5.1. Type Conversion
        1. 5.1.1. Implicit Conversions
        2. 5.1.2. Explicit Conversions
        3. 5.1.3. Explicit Conversions Using the Convert Commands
      2. 5.2. Complex Variable Types
        1. 5.2.1. Enumerations
          1. 5.2.1.1. Defining Enumerations
        2. 5.2.2. Structs
          1. 5.2.2.1. Defining Structs
        3. 5.2.3. Arrays
          1. 5.2.3.1. Declaring Arrays
          2. 5.2.3.2. foreach Loops
          3. 5.2.3.3. Multidimensional Arrays
          4. 5.2.3.4. Arrays of Arrays
      3. 5.3. String Manipulation
      4. 5.4. Summary
      5. 5.5. Exercises
    6. 6. Functions
      1. 6.1. Defining and Using Functions
        1. 6.1.1. Return Values
        2. 6.1.2. Parameters
          1. 6.1.2.1. Parameter Matching
          2. 6.1.2.2. Parameter Arrays
          3. 6.1.2.3. Reference and Value Parameters
          4. 6.1.2.4. Out Parameters
      2. 6.2. Variable Scope
        1. 6.2.1. Variable Scope in Other Structures
        2. 6.2.2. Parameters and Return Values Versus Global Data
      3. 6.3. The Main() Function
      4. 6.4. Struct Functions
      5. 6.5. Overloading Functions
      6. 6.6. Delegates
      7. 6.7. Summary
      8. 6.8. Exercises
    7. 7. Debugging and Error Handling
      1. 7.1. Debugging in VS and VCE
        1. 7.1.1. Debugging in Nonbreak (Normal) Mode
          1. 7.1.1.1. Outputting Debugging Information
          2. 7.1.1.2. Tracepoints
          3. 7.1.1.3. Diagnostics Output Versus Tracepoints
        2. 7.1.2. Debugging in Break Mode
          1. 7.1.2.1. Entering Break Mode
            1. 7.1.2.1.1. Breakpoints
            2. 7.1.2.1.2. Other Ways to Enter Break Mode
          2. 7.1.2.2. Monitoring Variable Content
          3. 7.1.2.3. Stepping through Code
          4. 7.1.2.4. Immediate and Command Windows
          5. 7.1.2.5. The Call Stack Window
      2. 7.2. Error Handling
        1. 7.2.1. try ... catch ... finally
        2. 7.2.2. Listing and Configuring Exceptions
        3. 7.2.3. Notes on Exception Handling
      3. 7.3. Summary
      4. 7.4. Exercises
    8. 8. Introduction to Object-Oriented Programming
      1. 8.1. What Is Object-Oriented Programming?
        1. 8.1.1. What Is an Object?
          1. 8.1.1.1. Properties and Fields
          2. 8.1.1.2. Methods
        2. 8.1.2. Everything's an Object
        3. 8.1.3. The Life Cycle of an Object
          1. 8.1.3.1. Constructors
          2. 8.1.3.2. Destructors
        4. 8.1.4. Static and Instance Class Members
          1. 8.1.4.1. Static Constructors
          2. 8.1.4.2. Static Classes
      2. 8.2. OOP Techniques
        1. 8.2.1. Interfaces
          1. 8.2.1.1. Disposable Objects
        2. 8.2.2. Inheritance
        3. 8.2.3. Polymorphism
          1. 8.2.3.1. Interface Polymorphism
        4. 8.2.4. Relationships Between Objects
          1. 8.2.4.1. Containment
          2. 8.2.4.2. Collections
        5. 8.2.5. Operator Overloading
        6. 8.2.6. Events
        7. 8.2.7. Reference Versus Value Types
          1. 8.2.7.1. Structs
      3. 8.3. OOP in Windows Applications
      4. 8.4. Summary
      5. 8.5. Exercises
    9. 9. Defining Classes
      1. 9.1. Class Definitions in C#
        1. 9.1.1. Interface Definitions
      2. 9.2. System.Object
      3. 9.3. Constructors and Destructors
        1. 9.3.1. Constructor Execution Sequence
      4. 9.4. OOP Tools in VS and VCE
        1. 9.4.1. The Class View Window
        2. 9.4.2. The Object Browser
        3. 9.4.3. Adding Classes
        4. 9.4.4. Class Diagrams
      5. 9.5. Class Library Projects
      6. 9.6. Interfaces Versus Abstract Classes
      7. 9.7. Struct Types
        1. 9.7.1. Shallow Copying versus Deep Copying
      8. 9.8. Summary
      9. 9.9. Exercises
    10. 10. Defining Class Members
      1. 10.1. Member Definitions
        1. 10.1.1. Defining Fields
        2. 10.1.2. Defining Methods
        3. 10.1.3. Defining Properties
        4. 10.1.4. Adding Members from a Class Diagram
          1. 10.1.4.1. Adding Methods
          2. 10.1.4.2. Adding Properties
          3. 10.1.4.3. Adding Fields
        5. 10.1.5. Refactoring Members
        6. 10.1.6. Automatic Properties
      2. 10.2. Additional Class Member Topics
        1. 10.2.1. Hiding Base Class Methods
        2. 10.2.2. Calling Overridden or Hidden Base Class Methods
          1. 10.2.2.1. The this Keyword
        3. 10.2.3. Nested Type Definitions
      3. 10.3. Interface Implementation
        1. 10.3.1. Implementing Interfaces in Classes
          1. 10.3.1.1. Explicit Interface Member Implementation
          2. 10.3.1.2. Adding Property Accessors with Nonpublic Accessibility
      4. 10.4. Partial Class Definitions
      5. 10.5. Partial Method Definitions
      6. 10.6. Example Application
        1. 10.6.1. Planning the Application
          1. 10.6.1.1. The Card Class
          2. 10.6.1.2. The Deck Class
        2. 10.6.2. Writing the Class Library
          1. 10.6.2.1. Adding the Suit and Rank Enumerations
          2. 10.6.2.2. Adding the Card Class
          3. 10.6.2.3. Adding the Deck Class
        3. 10.6.3. A Client Application for the Class Library
      7. 10.7. Summary
      8. 10.8. Exercises
    11. 11. Collections, Comparisons, and Conversions
      1. 11.1. Collections
        1. 11.1.1. Using Collections
        2. 11.1.2. Defining Collections
        3. 11.1.3. Indexers
        4. 11.1.4. Adding a Cards Collection to CardLib
        5. 11.1.5. Keyed Collections and IDictionary
        6. 11.1.6. Iterators
          1. 11.1.6.1. Iterators and Collections
        7. 11.1.7. Deep Copying
        8. 11.1.8. Adding Deep Copying to CardLib
      2. 11.2. Comparisons
        1. 11.2.1. Type Comparison
          1. 11.2.1.1. Boxing and Unboxing
          2. 11.2.1.2. The is Operator
        2. 11.2.2. Value Comparison
          1. 11.2.2.1. Operator Overloading
          2. 11.2.2.2. Adding Operator Overloads to CardLib
          3. 11.2.2.3. The IComparable and IComparer Interfaces
          4. 11.2.2.4. Sorting Collections Using the IComparable and IComparer Interfaces
      3. 11.3. Conversions
        1. 11.3.1. Overloading Conversion Operators
        2. 11.3.2. The as Operator
      4. 11.4. Summary
      5. 11.5. Exercises
    12. 12. Generics
      1. 12.1. What Is a Generic?
      2. 12.2. Using Generics
        1. 12.2.1. Nullable Types
          1. 12.2.1.1. Operators and Nullable Types
          2. 12.2.1.2. The ?? Operator
        2. 12.2.2. The System.Collections.Generics Namespace
          1. 12.2.2.1. List<T>
          2. 12.2.2.2. Sorting and Searching Generic Lists
          3. 12.2.2.3. Dictionary<K, V>
          4. 12.2.2.4. Modifying CardLib to Use a Generic Collection Class
      3. 12.3. Defining Generics
        1. 12.3.1. Defining Generic Classes
          1. 12.3.1.1. The default Keyword
          2. 12.3.1.2. Constraining Types
          3. 12.3.1.3. Inheriting from Generic Classes
          4. 12.3.1.4. Generic Operators
          5. 12.3.1.5. Generic Structs
        2. 12.3.2. Defining Generic Interfaces
        3. 12.3.3. Defining Generic Methods
        4. 12.3.4. Defining Generic Delegates
      4. 12.4. Summary
      5. 12.5. Exercises
    13. 13. Additional OOP Techniques
      1. 13.1. The :: Operator and the Global Namespace Qualifier
      2. 13.2. Custom Exceptions
        1. 13.2.1. Exception Base Classes
        2. 13.2.2. Adding Custom Exceptions to CardLib
      3. 13.3. Events
        1. 13.3.1. What Is an Event?
        2. 13.3.2. Handling Events
        3. 13.3.3. Defining Events
          1. 13.3.3.1. Multipurpose Event Handlers
          2. 13.3.3.2. Return Values and Event Handlers
          3. 13.3.3.3. Anonymous Methods
      4. 13.4. Expanding and Using CardLib
        1. 13.4.1. A Card Game Client for CardLib
      5. 13.5. Summary
      6. 13.6. Exercises
    14. 14. C# 3.0 Language Enhancements
      1. 14.1. Initializers
        1. 14.1.1. Object Initializers
        2. 14.1.2. Collection Initializers
      2. 14.2. Type Inference
      3. 14.3. Anonymous Types
      4. 14.4. Extension Methods
      5. 14.5. Lambda Expressions
        1. 14.5.1. Anonymous Methods Recap
        2. 14.5.2. Lambda Expressions for Anonymous Methods
        3. 14.5.3. Lambda Expression Parameters
        4. 14.5.4. Lambda Expression Statement Bodies
        5. 14.5.5. Lambda Expressions as Delegates and Expression Trees
        6. 14.5.6. Lambda Expressions and Collections
      6. 14.6. Summary
      7. 14.7. Exercises
  6. II. Windows Programming
    1. 15. Basic Windows Programming
      1. 15.1. Controls
        1. 15.1.1. Properties
        2. 15.1.2. Anchoring, Docking, and Snapping Controls
          1. 15.1.2.1. Anchor and Dock Properties
        3. 15.1.3. Events
      2. 15.2. The Button Control
        1. 15.2.1. Button Properties
        2. 15.2.2. Button Events
          1. 15.2.2.1. Adding the Event Handlers
      3. 15.3. The Label and LinkLabel Controls
      4. 15.4. The TextBox Control
        1. 15.4.1. TextBox Properties
        2. 15.4.2. TextBox Events
          1. 15.4.2.1. Adding the Event Handlers
      5. 15.5. The RadioButton and CheckBox Controls
        1. 15.5.1. RadioButton Properties
        2. 15.5.2. RadioButton Events
        3. 15.5.3. CheckBox Properties
        4. 15.5.4. CheckBox Events
        5. 15.5.5. The GroupBox Control
      6. 15.6. The RichTextBox Control
        1. 15.6.1. RichTextBox Properties
        2. 15.6.2. RichTextBox Events
      7. 15.7. The ListBox and CheckedListBox Controls
        1. 15.7.1. ListBox Properties
        2. 15.7.2. ListBox Methods
        3. 15.7.3. ListBox Events
          1. 15.7.3.1. Adding the Event Handlers
      8. 15.8. The ListView Control
        1. 15.8.1. ListView Properties
        2. 15.8.2. ListView Methods
        3. 15.8.3. ListView Events
        4. 15.8.4. ListViewItem
        5. 15.8.5. ColumnHeader
        6. 15.8.6. The ImageList Control
          1. 15.8.6.1. Adding the Event Handlers
      9. 15.9. The TabControl Control
        1. 15.9.1. TabControl Properties
        2. 15.9.2. Working with the TabControl
          1. 15.9.2.1. Adding the Event Handler
      10. 15.10. Summary
      11. 15.11. Exercises
    2. 16. Advanced Windows Forms Features
      1. 16.1. Menus and Toolbars
        1. 16.1.1. Two Is One
        2. 16.1.2. Using the MenuStrip Control
        3. 16.1.3. Creating Menus Manually
        4. 16.1.4. Additional Properties of the ToolStripMenuItem
        5. 16.1.5. Adding Functionality to Menus
      2. 16.2. Toolbars
        1. 16.2.1. ToolStrip Properties
        2. 16.2.2. ToolStrip Items
          1. 16.2.2.1. Adding Event Handlers
        3. 16.2.3. StatusStrip
        4. 16.2.4. StatusStripStatusLabel Properties
      3. 16.3. SDI and MDI Applications
        1. 16.3.1. Building MDI Applications
      4. 16.4. Creating Controls
        1. 16.4.1. A LabelTextbox Control
          1. 16.4.1.1. Adding Properties
          2. 16.4.1.2. Adding the Event Handlers
        2. 16.4.2. Debugging User Controls
        3. 16.4.3. Extending the LabelTextbox Control
          1. 16.4.3.1. Adding More Properties
          2. 16.4.3.2. Adding More Event Handlers
          3. 16.4.3.3. Adding a Custom Event Handler
      5. 16.5. Summary
      6. 16.6. Exercises
    3. 17. Using Common Dialogs
      1. 17.1. Common Dialogs
      2. 17.2. How to Use Dialogs
      3. 17.3. File Dialogs
        1. 17.3.1. OpenFileDialog
          1. 17.3.1.1. Dialog Title
          2. 17.3.1.2. Specifying Directories
          3. 17.3.1.3. Setting the File Filter
          4. 17.3.1.4. Validation
          5. 17.3.1.5. Help
          6. 17.3.1.6. Results
          7. 17.3.1.7. OpenFileDialog Properties
        2. 17.3.2. SaveFileDialog
          1. 17.3.2.1. Dialog Title
          2. 17.3.2.2. File Extensions
          3. 17.3.2.3. Validation
          4. 17.3.2.4. Overwriting Existing Files
          5. 17.3.2.5. SaveFileDialog Properties
      4. 17.4. Printing
        1. 17.4.1. Printing Architecture
          1. 17.4.1.1. Printing Sequence
          2. 17.4.1.2. PrintPage Event
        2. 17.4.2. Printing Multiple Pages
        3. 17.4.3. PageSetupDialog
          1. 17.4.3.1. Paper
          2. 17.4.3.2. Margins
          3. 17.4.3.3. Orientation
          4. 17.4.3.4. Printer
        4. 17.4.4. PrintDialog
          1. 17.4.4.1. Options for the PrintDialog
          2. 17.4.4.2. Printing Selected Text
          3. 17.4.4.3. Printing Page Ranges
          4. 17.4.4.4. PrintDialog Properties
      5. 17.5. Print Preview
        1. 17.5.1. PrintPreviewDialog
        2. 17.5.2. PrintPreviewControl
      6. 17.6. FontDialog and ColorDialog
        1. 17.6.1. FontDialog
          1. 17.6.1.1. How to Use the FontDialog
          2. 17.6.1.2. Properties of the FontDialog
          3. 17.6.1.3. Enabling the Apply Button
        2. 17.6.2. ColorDialog
          1. 17.6.2.1. How to Use the ColorDialog
          2. 17.6.2.2. Properties of the ColorDialog
        3. 17.6.3. FolderBrowserDialog
          1. 17.6.3.1. How to Use the Folder Browser Dialog
          2. 17.6.3.2. Properties of the Folder Browser Dialog
      7. 17.7. Summary
      8. 17.8. Exercises
    4. 18. Deploying Windows Applications
      1. 18.1. Deployment Overview
      2. 18.2. ClickOnce Deployment
        1. 18.2.1. Updates
      3. 18.3. Visual Studio Setup and Deployment Project Types
      4. 18.4. Microsoft Windows Installer Architecture
        1. 18.4.1. Windows Installer Terms
        2. 18.4.2. Advantages of the Windows Installer
      5. 18.5. Creating an Installation Package for the SimpleEditor
        1. 18.5.1. Planning the Installation
        2. 18.5.2. Creating the Project
        3. 18.5.3. Project Properties
          1. 18.5.3.1. Packaging
          2. 18.5.3.2. Prerequisites
          3. 18.5.3.3. Setup Editors
        4. 18.5.4. File System Editor
          1. 18.5.4.1. Adding Items to Special Folders
          2. 18.5.4.2. File Properties
        5. 18.5.5. File Types Editor
          1. 18.5.5.1. Create Actions
        6. 18.5.6. Launch Condition Editor
        7. 18.5.7. User Interface Editor
          1. 18.5.7.1. Additional Dialogs
      6. 18.6. Building the Project
      7. 18.7. Installation
        1. 18.7.1. Welcome
        2. 18.7.2. Read Me
        3. 18.7.3. License Agreement
        4. 18.7.4. Optional Files
        5. 18.7.5. Select Installation Folder
          1. 18.7.5.1. Disk Cost
        6. 18.7.6. Confirm Installation
        7. 18.7.7. Progress
        8. 18.7.8. Installation Complete
        9. 18.7.9. Running the Application
        10. 18.7.10. Uninstall
      8. 18.8. Summary
      9. 18.9. Exercises
  7. III. Web Programming
    1. 19. Basic Web Programming
      1. 19.1. Overview
      2. 19.2. ASP.NET Runtime
      3. 19.3. Creating a Simple Page
      4. 19.4. Server Controls
      5. 19.5. Event Handlers
      6. 19.6. Input Validation
      7. 19.7. State Management
        1. 19.7.1. Client-Side State Management
          1. 19.7.1.1. ViewState
          2. 19.7.1.2. Cookies
        2. 19.7.2. Server-Side State Management
          1. 19.7.2.1. Session
          2. 19.7.2.2. Application
          3. 19.7.2.3. Cache
      8. 19.8. Authentication and Authorization
        1. 19.8.1. Authentication Configuration
        2. 19.8.2. Using Security Controls
      9. 19.9. Reading and Writing to an SQL Server Database
      10. 19.10. Summary
      11. 19.11. Exercises
    2. 20. Advanced Web Programming
      1. 20.1. Master Pages
      2. 20.2. Site Navigation
      3. 20.3. User Controls
      4. 20.4. Profiles
        1. 20.4.1. Profile Groups
        2. 20.4.2. Profiles with Components
        3. 20.4.3. Profiles with Custom Data Types
        4. 20.4.4. Profiles with Anonymous Users
      5. 20.5. Web Parts
        1. 20.5.1. Web Parts Manager
        2. 20.5.2. Web Parts Zone
        3. 20.5.3. Editor Zone
        4. 20.5.4. Catalog Zone
        5. 20.5.5. Connections
      6. 20.6. JavaScript
        1. 20.6.1. Script Element
        2. 20.6.2. Declaration of Variables
        3. 20.6.3. Defining Functions
        4. 20.6.4. Statements
        5. 20.6.5. Objects
      7. 20.7. Summary
      8. 20.8. Exercises
    3. 21. Web Services
      1. 21.1. Before Web Services
        1. 21.1.1. Remote Procedure Call (RPC)
          1. 21.1.1.1. CORBA
          2. 21.1.1.2. DCOM
          3. 21.1.1.3. RMI
        2. 21.1.2. SOAP
      2. 21.2. Where to Use Web Services
        1. 21.2.1. A Hotel Travel Agency Application Scenario
        2. 21.2.2. A Book Distributor Application Scenario
        3. 21.2.3. Client Application Types
        4. 21.2.4. Application Architecture
      3. 21.3. Web Services Architecture
        1. 21.3.1. What Methods Can I Call?
        2. 21.3.2. Calling a Method
        3. 21.3.3. SOAP and Firewalls
        4. 21.3.4. WS-I Basic Profile
      4. 21.4. Web Services and the .NET Framework
        1. 21.4.1. Creating a Web Service
          1. 21.4.1.1. WebService Attribute
          2. 21.4.1.2. WebMethod Attribute
          3. 21.4.1.3. WebServiceBinding Attribute
        2. 21.4.2. Client
          1. 21.4.2.1. SoapHttpClientProtocol
          2. 21.4.2.2. Alternative Client Protocols
      5. 21.5. Creating a Simple ASP.NET Web Service
        1. 21.5.1. Adding a Web Method
      6. 21.6. Testing the Web Service
      7. 21.7. Implementing a Windows Client
      8. 21.8. Calling the Service Asynchronously
      9. 21.9. Implementing an ASP.NET Client
      10. 21.10. Passing Data
      11. 21.11. Summary
      12. 21.12. Exercises
    4. 22. Ajax Programming
      1. 22.1. Ajax Overview
      2. 22.2. Update Panel
      3. 22.3. Timer Control
      4. 22.4. Update Progress
      5. 22.5. Web Services
      6. 22.6. Extender Controls
      7. 22.7. Summary
      8. 22.8. Exercises
    5. 23. Deploying Web Applications
      1. 23.1. Internet Information Services
      2. 23.2. IIS Configuration
      3. 23.3. Copying a Web Site
      4. 23.4. Publishing a Web Site
      5. 23.5. Windows Installer
        1. 23.5.1. Creating a Setup Program
        2. 23.5.2. Installing the Web Application
      6. 23.6. Summary
      7. 23.7. Exercises
  8. IV. Data Access
    1. 24. File System Data
      1. 24.1. Streams
      2. 24.2. The Classes for Input and Output
        1. 24.2.1. The File and Directory Classes
        2. 24.2.2. The FileInfo Class
        3. 24.2.3. The DirectoryInfo Class
        4. 24.2.4. Path Names and Relative Paths
        5. 24.2.5. The FileStream Object
          1. 24.2.5.1. File Position
          2. 24.2.5.2. Reading Data
          3. 24.2.5.3. Writing Data
        6. 24.2.6. The StreamWriter Object
        7. 24.2.7. The StreamReader Object
          1. 24.2.7.1. Reading Data
          2. 24.2.7.2. Delimited Files
        8. 24.2.8. Reading and Writing Compressed Files
      3. 24.3. Serialized Objects
      4. 24.4. Monitoring the File Structure
      5. 24.5. Summary
      6. 24.6. Exercises
    2. 25. XML
      1. 25.1. XML Documents
        1. 25.1.1. XML Elements
        2. 25.1.2. Attributes
        3. 25.1.3. The XML Declaration
        4. 25.1.4. Structure of an XML Document
        5. 25.1.5. XML Namespaces
        6. 25.1.6. Well-Formed and Valid XML
        7. 25.1.7. Validating XML Documents
          1. 25.1.7.1. Schemas
            1. 25.1.7.1.1. XSD Schemas
      2. 25.2. Using XML in Your Application
        1. 25.2.1. XML Document Object Model
          1. 25.2.1.1. XmlDocument Class
          2. 25.2.1.2. XmlElement Class
          3. 25.2.1.3. Changing the Values of Nodes
            1. 25.2.1.3.1. Inserting New Nodes
            2. 25.2.1.3.2. Deleting Nodes
        2. 25.2.2. Selecting Nodes
          1. 25.2.2.1. XPath
      3. 25.3. Summary
      4. 25.4. Exercises
    3. 26. Introduction to LINQ
      1. 26.1. LINQ Varieties
      2. 26.2. First LINQ Query
        1. 26.2.1. Declaring a Variable for Results Using the var Keyword
        2. 26.2.2. Specify Data Source: from Clause
        3. 26.2.3. Specify Condition: where Clause
        4. 26.2.4. Select Items: select Clause
        5. 26.2.5. Finishing Up: Using the foreach Loop
        6. 26.2.6. Deferred Query Execution
      3. 26.3. Using the LINQ Method Syntax and Lambda Expressions
        1. 26.3.1. LINQ Extension Methods
        2. 26.3.2. Query Syntax versus Method Syntax
        3. 26.3.3. Lambda Expressions
      4. 26.4. Ordering Query Results
      5. 26.5. orderby Clause
      6. 26.6. Ordering Using Method Syntax
      7. 26.7. Querying a Large Data Set
      8. 26.8. Aggregate Operators
      9. 26.9. Querying Complex Objects
      10. 26.10. Projection: Creating New Objects in Queries
      11. 26.11. Projection: Method Syntax
      12. 26.12. Select Distinct Query
      13. 26.13. Any and All
      14. 26.14. Ordering By Multiple Levels
      15. 26.15. Multi-Level Ordering Method Syntax: ThenBy
      16. 26.16. Group Queries
      17. 26.17. Take and Skip
      18. 26.18. First and FirstOrDefault
      19. 26.19. Set Operators
      20. 26.20. Joins
      21. 26.21. Resources and Further Reading
      22. 26.22. Summary
      23. 26.23. Exercises
    4. 27. LINQ to SQL
      1. 27.1. Object-Relational Mapping ( ORM )
      2. 27.2. Installing SQL Server and the Northwind Sample Data
        1. 27.2.1. Install SQL Server Express 2005
        2. 27.2.2. Installing the Northwind Sample Database
      3. 27.3. First LINQ to SQL Query
      4. 27.4. Navigating LINQ to SQL Relationships
      5. 27.5. Drilling Down Further with LINQ to SQL
      6. 27.6. Grouping, Ordering, and Other Advanced Queries in LINQ to SQL
      7. 27.7. Displaying Generated SQL
      8. 27.8. Data Binding with LINQ to SQL
      9. 27.9. Updating Bound Data with LINQ to SQL
      10. 27.10. Summary
      11. 27.11. Exercises
    5. 28. ADO.NET and LINQ over DataSet
      1. 28.1. What Is ADO.NET?
        1. 28.1.1. Why Is It Called ADO.NET?
        2. 28.1.2. Design Goals of ADO.NET
          1. 28.1.2.1. Simple Access to Relational Data
          2. 28.1.2.2. Extensibility
          3. 28.1.2.3. Support for Multitier Applications
          4. 28.1.2.4. Unification of XML and Relational Data Access
      2. 28.2. Overview of ADO.NET Classes and Objects
        1. 28.2.1. Provider Objects
          1. 28.2.1.1. Connection Object
          2. 28.2.1.2. Command Object
          3. 28.2.1.3. CommandBuilder Object
          4. 28.2.1.4. DataReader Object
          5. 28.2.1.5. DataAdapter Object
        2. 28.2.2. Consumer Objects
          1. 28.2.2.1. DataSet Object
          2. 28.2.2.2. DataTable Object
            1. 28.2.2.2.1. DataRelation Object
        3. 28.2.3. Using the System.Data Namespace
          1. 28.2.3.1. SQL Server .NET Data Provider
          2. 28.2.3.2. Oracle .NET Data Provider
          3. 28.2.3.3. OLE DB .NET Data Provider
          4. 28.2.3.4. ODBC .NET Data Provider
          5. 28.2.3.5. Other Native .NET Data Providers
      3. 28.3. Reading Data with the DataReader
      4. 28.4. Reading Data with the DataSet
        1. 28.4.1. Filling the DataSet with Data
        2. 28.4.2. Accessing Tables, Rows, and Columns in the DataSet
      5. 28.5. Updating the Database
        1. 28.5.1. Adding Rows to the Database
          1. 28.5.1.1. Finding Rows
        2. 28.5.2. Deleting Rows
      6. 28.6. Accessing Multiple Tables in a DataSet
        1. 28.6.1. Relationships in ADO.NET
          1. 28.6.1.1. Creating a DataRelation Object
        2. 28.6.2. Navigating with Relationships
          1. 28.6.2.1. Fetching the Child Rows
      7. 28.7. XML and ADO.NET
        1. 28.7.1. XML Support in ADO.NET DataSets
      8. 28.8. SQL Support in ADO.NET
        1. 28.8.1. SQL Commands in Data Adapters
          1. 28.8.1.1. Using WHERE with SELECT
          2. 28.8.1.2. Viewing SQL SELECT, UPDATE, INSERT, and DELETE Commands
        2. 28.8.2. Direct Execution of SQL Commands
          1. 28.8.2.1. Retrieving Single Values
          2. 28.8.2.2. Retrieving No Data
        3. 28.8.3. Calling a SQL Stored Procedure
      9. 28.9. Using LINQ over DataSet with ADO.NET
        1. 28.9.1. When to Use LINQ over DataSet
      10. 28.10. Summary
      11. 28.11. Exercises
    6. 29. LINQ to XML
      1. 29.1. LINQ to XML Functional Constructors
        1. 29.1.1.
          1. 29.1.1.1. Constructing XML Element Text with Strings
      2. 29.2. Saving and Loading an XML Document
        1. 29.2.1. Loading XML from a String
        2. 29.2.2. Contents of a Saved XML Document
      3. 29.3. Working with XML Fragments
      4. 29.4. Generating XML from LINQ to SQL
        1. 29.4.1. Displaying the Northwind Customer Orders XML Document
      5. 29.5. How to Query an XML Document
        1. 29.5.1. Using Query Members
          1. 29.5.1.1. Elements()
          2. 29.5.1.2. Descendants()
          3. 29.5.1.3. Attributes()
      6. 29.6. Summary
      7. 29.7. Exercises
  9. V. Additional Techniques
    1. 30. Attributes
      1. 30.1. What Is an Attribute?
      2. 30.2. Reflection
      3. 30.3. Built-in Attributes
        1. 30.3.1. System.Diagnostics.ConditionalAttribute
        2. 30.3.2. System.ObsoleteAttribute
        3. 30.3.3. System.SerializableAttribute
        4. 30.3.4. System.Reflection.AssemblyDelaySignAttribute
          1. 30.3.4.1. Delay-Signing the Assembly
          2. 30.3.4.2. Registering in the GAC
          3. 30.3.4.3. Completing the Strong Name
      4. 30.4. Custom Attributes
        1. 30.4.1. BugFixAttribute
          1. 30.4.1.1. Creating the Custom Attribute Class
          2. 30.4.1.2. Creating Constructors and Properties
          3. 30.4.1.3. Attributing the Class for Usage
          4. 30.4.1.4. System.AttributeUsageAttribute
          5. 30.4.1.5. Attribute Scope
          6. 30.4.1.6. AttributeUsage.AllowMultiple
          7. 30.4.1.7. AttributeUsage.Inherited
      5. 30.5. Summary
    2. 31. XML Documentation
      1. 31.1. Adding XML Documentation
        1. 31.1.1. XML Documentation Comments
          1. 31.1.1.1. Text Formatting Elements
            1. 31.1.1.1.1. <para>
            2. 31.1.1.1.2. <c> and <code>
            3. 31.1.1.1.3. <see>, <seealso>, <paramref>, and <typeparamref>
            4. 31.1.1.1.4. <list> and Associated Elements
          2. 31.1.1.2. Major Structural Elements
            1. 31.1.1.2.1. <summary>, <example>, and <remarks>
            2. 31.1.1.2.2. <param> and <typeparam>
            3. 31.1.1.2.3. <returns> and <value>
            4. 31.1.1.2.4. <permission>
            5. 31.1.1.2.5. <exception>
            6. 31.1.1.2.6. <seealso>
            7. 31.1.1.2.7. <include>
        2. 31.1.2. Adding XML Documentation Using a Class Diagram
        3. 31.1.3. Generating XML Documentation Files
        4. 31.1.4. Example Application with XML Documentation
      2. 31.2. Making Use of XML Documentation
        1. 31.2.1. Programmatically Processing XML Documentation
        2. 31.2.2. Styling XML Documentation with XSLT
        3. 31.2.3. Documentation Tools
      3. 31.3. Summary
      4. 31.4. Exercises
    3. 32. Networking
      1. 32.1. Networking Overview
        1. 32.1.1. Name Resolution
        2. 32.1.2. Uniform Resource Identifier
        3. 32.1.3. TCP and UDP
        4. 32.1.4. Application Protocols
      2. 32.2. Networking Programming Options
      3. 32.3. WebClient
      4. 32.4. WebRequest and WebResponse
      5. 32.5. TcpListener and TcpClient
      6. 32.6. Summary
      7. 32.7. Exercises
    4. 33. Introduction to GDI +
      1. 33.1. Overview of Graphical Drawing
        1. 33.1.1. The Graphics Class
        2. 33.1.2. Disposing of Objects
        3. 33.1.3. Coordinate System
          1. 33.1.3.1. Point
          2. 33.1.3.2. Size
          3. 33.1.3.3. Rectangle
          4. 33.1.3.4. GraphicsPaths
          5. 33.1.3.5. Regions
        4. 33.1.4. Colors
      2. 33.2. Drawing Lines Using the Pen Class
      3. 33.3. Drawing Shapes Using the Brush Class
      4. 33.4. Drawing Text Using the Font Class
      5. 33.5. Drawing Using Images
        1. 33.5.1. Drawing with a Texture Brush
        2. 33.5.2. Double-Buffering
      6. 33.6. Advanced Capabilities of GDI +
        1. 33.6.1. Clipping
        2. 33.6.2. System.Drawing.Drawing2D
        3. 33.6.3. System.Drawing.Imaging
      7. 33.7. Summary
      8. 33.8. Exercises
    5. 34. Windows Presentation Foundation
      1. 34.1. What Is WPF?
        1. 34.1.1. WPF for Designers
        2. 34.1.2. WPF for C# Developers
      2. 34.2. Anatomy of a Basic WPF Application
      3. 34.3. WPF Fundamentals
        1. 34.3.1. XAML Syntax
          1. 34.3.1.1. Object Element Syntax
          2. 34.3.1.2. Attribute Syntax
          3. 34.3.1.3. Property Element Syntax
          4. 34.3.1.4. Content Syntax
          5. 34.3.1.5. Mixing Property Element Syntax and Content Syntax
          6. 34.3.1.6. Markup Extensions
        2. 34.3.2. Desktop and Web Applications
        3. 34.3.3. The Application Object
        4. 34.3.4. Control Basics
          1. 34.3.4.1. Dependency Properties
          2. 34.3.4.2. Attached Properties
          3. 34.3.4.3. Routed Events
          4. 34.3.4.4. Attached Events
        5. 34.3.5. Control Layout
          1. 34.3.5.1. Stack Order
          2. 34.3.5.2. Alignment, Margins, Padding, and Dimensions
          3. 34.3.5.3. Border
          4. 34.3.5.4. Canvas
          5. 34.3.5.5. DockPanel
          6. 34.3.5.6. Grid
          7. 34.3.5.7. StackPanel
          8. 34.3.5.8. WrapPanel
        6. 34.3.6. Control Styling
          1. 34.3.6.1. Styles
          2. 34.3.6.2. Templates
        7. 34.3.7. Triggers
        8. 34.3.8. Animation
          1. 34.3.8.1. Timelines Without Key Frames
          2. 34.3.8.2. Timelines with Key Frames
        9. 34.3.9. Static and Dynamic Resources
          1. 34.3.9.1. Static Resources
          2. 34.3.9.2. Dynamic Resources
          3. 34.3.9.3. Referencing Style Resources
      4. 34.4. Programming with WPF
        1. 34.4.1. WPF User Controls
        2. 34.4.2. Implementing Dependency Properties
      5. 34.5. Summary
      6. 34.6. Exercises
    6. 35. Windows Communication Foundation
      1. 35.1. What Is WCF?
      2. 35.2. WCF Concepts
        1. 35.2.1. WCF Communication Protocols
        2. 35.2.2. Addresses, Endpoints, and Bindings
        3. 35.2.3. Contracts
        4. 35.2.4. Message Patterns
        5. 35.2.5. Behaviors
        6. 35.2.6. Hosting
      3. 35.3. WCF Programming
        1. 35.3.1. Defining WCF Service Contracts
          1. 35.3.1.1. Data Contracts
          2. 35.3.1.2. Service Contracts
          3. 35.3.1.3. Operation Contracts
          4. 35.3.1.4. Message Contracts
          5. 35.3.1.5. Fault Contracts
        2. 35.3.2. Self-Hosted WCF Services
      4. 35.4. Summary
      5. 35.5. Exercises
    7. 36. Windows Workflow Foundation
      1. 36.1. Activities
        1. 36.1.1. DelayActivity
        2. 36.1.2. SuspendActivity
        3. 36.1.3. WhileActivity
        4. 36.1.4. SequenceActivity
          1. 36.1.4.1. Handling Faults
          2. 36.1.4.2. Providing Cleanup Code
        5. 36.1.5. Custom Activities
          1. 36.1.5.1. Activity Validation
          2. 36.1.5.2. Adding an Activity Validator
          3. 36.1.5.3. Enhancing Design Time
      2. 36.2. The Workflow Runtime
      3. 36.3. Data Binding
      4. 36.4. Summary

Product information

  • Title: Beginning Microsoft® Visual C#® 2008
  • Author(s):
  • Release date: May 2008
  • Publisher(s): Wrox
  • ISBN: 9780470191354