Contents

Preface

Before You Begin

1. Introduction

1.1. Introduction

1.2. Microsoft’s Windows® Operating System

1.3. C, C++, Objective-C and Java

1.4. C#

1.5. Extensible Markup Language (XML)

1.6. Introduction to Microsoft .NET

1.7. The .NET Framework and the Common Language Runtime

1.8. Test-Driving the Advanced Painter Application

1.9. Introduction to Object Technology

1.10. Wrap-Up

2. Dive Into® Visual C# 2010 Express

2.1. Introduction

2.2. Overview of the Visual Studio 2010 IDE

2.3. Menu Bar and Toolbar

2.4. Navigating the Visual Studio IDE

2.4.1. Solution Explorer

2.4.2. Toolbox

2.4.3. Properties Window

2.5. Using Help

2.6. Using Visual Programming to Create a Simple Program that Displays Text and an Image

2.7. Wrap-Up

2.8. Web Resources

3. Introduction to C# Applications

3.1. Introduction

3.2. A Simple C# Application: Displaying a Line of Text

3.3. Creating a Simple Application in Visual C# Express

3.4. Modifying Your Simple C# Application

3.5. Formatting Text with Console.Write and Console.WriteLine

3.6. Another C# Application: Adding Integers

3.7. Arithmetic

3.8. Decision Making: Equality and Relational Operators

3.9. Wrap-Up

4. Introduction to Classes and Objects

4.1. Introduction

4.2. Classes, Objects, Methods, Properties and Instance Variables

4.3. Declaring a Class with a Method and Instantiating an Object of a Class

4.4. Declaring a Method with a Parameter

4.5. Instance Variables and Properties

4.6. UML Class Diagram with a Property

4.7. Software Engineering with Properties and set and get Accessors

4.8. Auto-Implemented Properties

4.9. Value Types vs. Reference Types

4.10. Initializing Objects with Constructors

4.11. Floating-Point Numbers and Type decimal

4.12. Wrap-Up

5. Control Statements: Part 1

5.1. Introduction

5.2. Control Structures

5.3. if Single-Selection Statement

5.4. if...else Double-Selection Statement

5.5. while Repetition Statement

5.6. Counter-Controlled Repetition

5.7. Sentinel-Controlled Repetition

5.8. Nested Control Statements

5.9. Compound Assignment Operators

5.10. Increment and Decrement Operators

5.11. Simple Types

5.12. Wrap-Up

6. Control Statements: Part 2

6.1. Introduction

6.2. Essentials of Counter-Controlled Repetition

6.3. for Repetition Statement

6.4. Examples Using the for Statement

6.5. do...while Repetition Statement

6.6. switch Multiple-Selection Statement

6.7. break and continue Statements

6.8. Logical Operators

6.9. Wrap-Up

7. Methods: A Deeper Look

7.1. Introduction

7.2. Packaging Code in C#

7.3. static Methods, static Variables and Class Math

7.4. Declaring Methods with Multiple Parameters

7.5. Notes on Declaring and Using Methods

7.6. Method-Call Stack and Activation Records

7.7. Argument Promotion and Casting

7.8. The .NET Framework Class Library

7.9. Case Study: Random-Number Generation

7.9.1. Scaling and Shifting Random Numbers

7.9.2. Random-Number Repeatability for Testing and Debugging

7.10. Case Study: A Game of Chance (Introducing Enumerations)

7.11. Scope of Declarations

7.12. Method Overloading

7.13. Optional Parameters

7.14. Named Parameters

7.15. Recursion

7.16. Passing Arguments: Pass-by-Value vs. Pass-by-Reference

7.17. Wrap-Up

8. Arrays

8.1. Introduction

8.2. Arrays

8.3. Declaring and Creating Arrays

8.4. Examples Using Arrays

8.5. Case Study: Card Shuffling and Dealing Simulation

8.6. foreach Statement

8.7. Passing Arrays and Array Elements to Methods

8.8. Passing Arrays by Value and by Reference

8.9. Case Study: Class GradeBook Using an Array to Store Grades

8.10. Multidimensional Arrays

8.11. Case Study: GradeBook Using a Rectangular Array

8.12. Variable-Length Argument Lists

8.13. Using Command-Line Arguments

8.14. Wrap-Up

9. Introduction to LINQ and the List Collection

9.1. Introduction

9.2. Querying an Array of int Values Using LINQ

9.3. Querying an Array of Employee Objects Using LINQ

9.4. Introduction to Collections

9.5. Querying a Generic Collection Using LINQ

9.6. Wrap-Up

9.7. Deitel LINQ Resource Center

10. Classes and Objects: A Deeper Look

10.1. Introduction

10.2. Time Class Case Study

10.3. Controlling Access to Members

10.4. Referring to the Current Object’s Members with the this Reference

10.5. Indexers

10.6. Time Class Case Study: Overloaded Constructors

10.7. Default and Parameterless Constructors

10.8. Composition

10.9. Garbage Collection and Destructors

10.10. static Class Members

10.11. readonly Instance Variables

10.12. Data Abstraction and Encapsulation

10.13. Time Class Case Study: Creating Class Libraries

10.14. internal Access

10.15. Class View and Object Browser

10.16. Object Initializers

10.17. Time Class Case Study: Extension Methods

10.18. Delegates

10.19. Lambda Expressions

10.20. Anonymous Types

10.21. Wrap-Up

11. Object-Oriented Programming: Inheritance

11.1. Introduction

11.2. Base Classes and Derived Classes

11.3. protected Members

11.4. Relationship between Base Classes and Derived Classes

11.4.1. Creating and Using a CommissionEmployee Class

11.4.2. Creating a BasePlusCommissionEmployee Class without Using Inheritance

11.4.3. Creating a CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy

11.4.4. CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables

11.4.5. CommissionEmployeeBasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables

11.5. Constructors in Derived Classes

11.6. Software Engineering with Inheritance

11.7. Class object

11.8. Wrap-Up

12. OOP: Polymorphism, Interfaces and Operator Overloading

12.1. Introduction

12.2. Polymorphism Examples

12.3. Demonstrating Polymorphic Behavior

12.4. Abstract Classes and Methods

12.5. Case Study: Payroll System Using Polymorphism

12.5.1. Creating Abstract Base Class Employee

12.5.2. Creating Concrete Derived Class SalariedEmployee

12.5.3. Creating Concrete Derived Class HourlyEmployee

12.5.4. Creating Concrete Derived Class CommissionEmployee

12.5.5. Creating Indirect Concrete Derived Class BasePlusCommissionEmployee

12.5.6. Polymorphic Processing, Operator is and Downcasting

12.5.7. Summary of the Allowed Assignments Between Base-Class and Derived-Class Variables

12.6. sealed Methods and Classes

12.7. Case Study: Creating and Using Interfaces

12.7.1. Developing an IPayable Hierarchy

12.7.2. Declaring Interface IPayable

12.7.3. Creating Class Invoice

12.7.4. Modifying Class Employee to Implement Interface IPayable

12.7.5. Modifying Class SalariedEmployee for Use with IPayable

12.7.6. Using Interface IPayable to Process Invoices and Employees Polymorphically

12.7.7. Common Interfaces of the .NET Framework Class Library

12.8. Operator Overloading

12.9. Wrap-Up

13. Exception Handling

13.1. Introduction

13.2. Example: Divide by Zero without Exception Handling

13.3. Example: Handling DivideByZeroExceptions and FormatExceptions

13.3.1. Enclosing Code in a try Block

13.3.2. Catching Exceptions

13.3.3. Uncaught Exceptions

13.3.4. Termination Model of Exception Handling

13.3.5. Flow of Control When Exceptions Occur

13.4. .NET Exception Hierarchy

13.4.1. Class SystemException

13.4.2. Determining Which Exceptions a Method Throws

13.5. finally Block

13.6. The using Statement

13.7. Exception Properties

13.8. User-Defined Exception Classes

13.9. Wrap-Up

14. Graphical User Interfaces with Windows Forms: Part 1

14.1. Introduction

14.2. Windows Forms

14.3. Event Handling

14.3.1. A Simple Event-Driven GUI

14.3.2. Visual Studio Generated GUI Code

14.3.3. Delegates and the Event-Handling Mechanism

14.3.4. Another Way to Create Event Handlers

14.3.5. Locating Event Information

14.4. Control Properties and Layout

14.5. Labels, TextBoxes and Buttons

14.6. GroupBoxes and Panels

14.7. CheckBoxes and RadioButtons

14.8. PictureBoxes

14.9. ToolTips

14.10. NumericUpDown Control

14.11. Mouse-Event Handling

14.12. Keyboard-Event Handling

14.13. Wrap-Up

15. Graphical User Interfaces with Windows Forms: Part 2

15.1. Introduction

15.2. Menus

15.3. MonthCalendar Control

15.4. DateTimePicker Control

15.5. LinkLabel Control

15.6. ListBox Control

15.7. CheckedListBox Control

15.8. ComboBox Control

15.9. TreeView Control

15.10. ListView Control

15.11. TabControl Control

15.12. Multiple Document Interface (MDI) Windows

15.13. Visual Inheritance

15.14. User-Defined Controls

15.15. Wrap-Up

16. Strings and Characters

16.1. Introduction

16.2. Fundamentals of Characters and Strings

16.3. string Constructors

16.4. string Indexer, Length Property and CopyTo Method

16.5. Comparing strings

16.6. Locating Characters and Substrings in strings

16.7. Extracting Substrings from strings

16.8. Concatenating strings

16.9. Miscellaneous string Methods

16.10. Class StringBuilder

16.11. Length and Capacity Properties, EnsureCapacity Method and Indexer of Class StringBuilder

16.12. Append and AppendFormat Methods of Class StringBuilder

16.13. Insert, Remove and Replace Methods of Class StringBuilder

16.14. Char Methods

16.15. Regular Expressions

16.15.1. Simple Regular Expressions and Class Regex

16.15.2. Complex Regular Expressions

16.15.3. Validating User Input with Regular Expressions and LINQ

16.15.4. Regex Methods Replace and Split

16.16. Wrap-Up

17. Files and Streams

17.1. Introduction

17.2. Data Hierarchy

17.3. Files and Streams

17.4. Classes File and Directory

17.5. Creating a Sequential-Access Text File

17.6. Reading Data from a Sequential-Access Text File

17.7. Case Study: Credit Inquiry Program

17.8. Serialization

17.9. Creating a Sequential-Access File Using Object Serialization

17.10. Reading and Deserializing Data from a Binary File

17.11. Wrap-Up

18. Databases and LINQ

18.1. Introduction

18.2. Relational Databases

18.3. A Books Database

18.4. LINQ to SQL

18.5. Querying a Database with LINQ

18.5.1. Creating LINQ to SQL Classes

18.5.2. Data Bindings Between Controls and the LINQ to SQL Classes

18.6. Dynamically Binding Query Results

18.6.1. Creating the Display Query Results GUI

18.6.2. Coding the Display Query Results Application

18.7. Retrieving Data from Multiple Tables with LINQ

18.8. Creating a Master/Detail View Application

18.8.1. Creating the Master/Detail GUI

18.8.2. Coding the Master/Detail Application

18.9. Address Book Case Study

18.9.1. Creating the Address Book Application’s GUI

18.9.2. Coding the Address Book Application

18.10. Tools and Web Resources

18.11. Wrap-Up

19. Web App Development with ASP.NET

19.1. Introduction

19.2. Web Basics

19.3. Multitier Application Architecture

19.4. Your First Web Application

19.4.1. Building the WebTime Application

19.4.2. Examining WebTime.aspx’s Code-Behind File

19.5. Standard Web Controls: Designing a Form

19.6. Validation Controls

19.7. Session Tracking

19.7.1. Cookies

19.7.2. Session Tracking with HttpSessionState

19.7.3. Options.aspx: Selecting a Programming Language

19.7.4. Recommendations.aspx: Displaying Recommendations Based on Session Values

19.8. Case Study: Database-Driven ASP.NET Guestbook

19.8.1. Building a Web Form that Displays Data from a Database

19.8.2. Modifying the Code-Behind File for the Guestbook Application

19.9. Case Study: ASP.NET AJAX

19.10. Case Study: Password-Protected Books Database Application

19.11. Wrap-Up

20. Searching and Sorting

20.1. Introduction

20.2. Searching Algorithms

20.2.1. Linear Search

20.2.2. Binary Search

20.3. Sorting Algorithms

20.3.1. Selection Sort

20.3.2. Insertion Sort

20.3.3. Merge Sort

20.4. Summary of the Efficiency of Searching and Sorting Algorithms

20.5. Wrap-Up

21. Data Structures

21.1. Introduction

21.2. Simple-Type structs, Boxing and Unboxing

21.3. Self-Referential Classes

21.4. Linked Lists

21.5. Stacks

21.6. Queues

21.7. Trees

21.7.1. Binary Search Tree of Integer Values

21.7.2. Binary Search Tree of IComparable Objects

21.8. Wrap-Up

22. Generics

22.1. Introduction

22.2. Motivation for Generic Methods

22.3. Generic-Method Implementation

22.4. Type Constraints

22.5. Overloading Generic Methods

22.6. Generic Classes

22.7. Wrap-Up

23. Collections

23.1. Introduction

23.2. Collections Overview

23.3. Class Array and Enumerators

23.4. Nongeneric Collections

23.4.1. Class ArrayList

23.4.2. Class Stack

23.4.3. Class Hashtable

23.5. Generic Collections

23.5.1. Generic Class SortedDictionary

23.5.2. Generic Class LinkedList

23.6. Covariance and Contravariance for Generic Types

23.7. Wrap-Up

24. GUI with Windows Presentation Foundation

24.1. Introduction

24.2. Windows Presentation Foundation (WPF)

24.3. XML Basics

24.4. Structuring Data

24.5. XML Namespaces

24.6. Declarative GUI Programming Using XAML

24.7. Creating a WPF Application in Visual C# Express

24.8. Laying Out Controls

24.8.1. General Layout Principles

24.8.2. Layout in Action

24.9. Event Handling

24.10. Commands and Common Application Tasks

24.11. WPF GUI Customization

24.12. Using Styles to Change the Appearance of Controls

24.13. Customizing Windows

24.14. Defining a Control’s Appearance with Control Templates

24.15. Data-Driven GUIs with Data Binding

24.16. Wrap-Up

24.17. Web Resources

25. WPF Graphics and Multimedia

25.1. Introduction

25.2. Controlling Fonts

25.3. Basic Shapes

25.4. Polygons and Polylines

25.5. Brushes

25.6. Transforms

25.7. WPF Customization: A Television GUI

25.8. Animations

25.9. (Optional) 3-D Objects and Transforms

25.10. Speech Synthesis and Speech Recognition

25.11. Wrap-Up

26. XML and LINQ to XML

26.1. Introduction

26.2. Document Type Definitions (DTDs)

26.3. W3C XML Schema Documents

26.4. Extensible Stylesheet Language and XSL Transformations

26.5. LINQ to XML: Document Object Model (DOM)

26.6. LINQ to XML Class Hierarchy

26.7. LINQ to XML: Namespaces and Creating Documents

26.8. XSLT with Class XslCompiledTransform

26.9. Wrap-Up

26.10. Web Resources

27. Web App Development with ASP.NET: A Deeper Look

27.1. Introduction

27.2. Case Study: Password-Protected Books Database Application

27.2.1. Examining the ASP.NET Web Site Template

27.2.2. Test-Driving the Completed Application

27.2.3. Configuring the Website

27.2.4. Modifying the Default.aspx and About.aspx Pages

27.2.5. Creating a Content Page That Only Authenticated Users Can Access

27.2.6. Linking from the Default.aspx Page to the Books.aspx Page

27.2.7. Modifying the Master Page (Site.master)

27.2.8. Customizing the Password-Protected Books.aspx Page

27.3. ASP.NET Ajax

27.3.1. Traditional Web Applications

27.3.2. Ajax Web Applications

27.3.3. Testing an ASP.NET Ajax Application

27.3.4. The ASP.NET Ajax Control Toolkit

27.3.5. Using Controls from the Ajax Control Toolkit

27.4. Wrap-Up

28. Web Services

28.1. Introduction

28.2. WCF Services Basics

28.3. Simple Object Access Protocol (SOAP)

28.4. Representational State Transfer (REST)

28.5. JavaScript Object Notation (JSON)

28.6. Publishing and Consuming SOAP-Based WCF Web Services

28.6.1. Creating a WCF Web Service

28.6.2. Code for the WelcomeSOAPXMLService

28.6.3. Building a SOAP WCF Web Service

28.6.4. Deploying the WelcomeSOAPXMLService

28.6.5. Creating a Client to Consume the WelcomeSOAPXMLService

28.6.6. Consuming the WelcomeSOAPXMLService

28.7. Publishing and Consuming REST-Based XML Web Services

28.7.1. HTTP get and post Requests

28.7.2. Creating a REST-Based XML WCF Web Service

28.7.3. Consuming a REST-Based XML WCF Web Service

28.8. Publishing and Consuming REST-Based JSON Web Services

28.8.1. Creating a REST-Based JSON WCF Web Service

28.8.2. Consuming a REST-Based JSON WCF Web Service

28.9. Blackjack Web Service: Using Session Tracking in a SOAP-Based WCF Web Service

28.9.1. Creating a Blackjack Web Service

28.9.2. Consuming the Blackjack Web Service

28.10. Airline Reservation Web Service: Database Access and Invoking a Service from ASP.NET

28.11. Equation Generator: Returning User-Defined Types

28.11.1. Creating the REST-Based XML EquationGenerator Web Service

28.11.2. Consuming the REST-Based XML EquationGenerator Web Service

28.11.3. Creating the REST-Based JSON WCF EquationGenerator Web Service

28.11.4. Consuming the REST-Based JSON WCF EquationGenerator Web Service

28.12. Wrap-Up

28.13. Deitel Web Services Resource Centers

29. Silverlight and Rich Internet Applications

29.1. Introduction

29.2. Platform Overview

29.3. Silverlight Runtime and Tools Installation

29.4. Building a Silverlight WeatherViewer Application

29.4.1. GUI Layout

29.4.2. Obtaining and Displaying Weather Forecast Data

29.4.3. Custom Controls

29.5. Animations and the FlickrViewer

29.6. Images and Deep Zoom

29.6.1. Getting Started With Deep Zoom Composer

29.6.2. Creating a Silverlight Deep Zoom Application

29.7. Audio and Video

29.8. Wrap-Up

30. ATM Case Study, Part 1: Object-Oriented Design with the UML

30.1. Introduction

30.2. Examining the ATM Requirements Document

30.3. Identifying the Classes in the ATM Requirements Document

30.4. Identifying Class Attributes

30.5. Identifying Objects’ States and Activities

30.6. Identifying Class Operations

30.7. Identifying Collaboration Among Objects

30.8. Wrap-Up

31. ATM Case Study, Part 2: Implementing an Object-Oriented Design

31.1. Introduction

31.2. Starting to Program the Classes of the ATM System

31.3. Incorporating Inheritance and Polymorphism into the ATM System

31.4. ATM Case Study Implementation

31.4.1. Class ATM

31.4.2. Class Screen

31.4.3. Class Keypad

31.4.4. Class CashDispenser

31.4.5. Class DepositSlot

31.4.6. Class Account

31.4.7. Class BankDatabase

31.4.8. Class Transaction

31.4.9. Class BalanceInquiry

31.4.10. Class Withdrawal

31.4.11. Class Deposit

31.4.12. Class ATMCaseStudy

31.5. Wrap-Up

Operator Precedence Chart

Simple Types

ASCII Character Set

Number Systems

D.1. Introduction

D.2. Abbreviating Binary Numbers as Octal and Hexadecimal Numbers

D.3. Converting Octal and Hexadecimal Numbers to Binary Numbers

D.4. Converting from Binary, Octal or Hexadecimal to Decimal

D.5. Converting from Decimal to Binary, Octal or Hexadecimal

D.6. Negative Binary Numbers: Two’s Complement Notation

UML 2: Additional Diagram Types

E.1. Introduction

E.2. Additional Diagram Types

Unicode®

F.1. Introduction

F.2. Unicode Transformation Formats

F.3. Characters and Glyphs

F.4. Advantages/Disadvantages of Unicode

F.5. Using Unicode

F.6. Character Ranges

Using the Visual C# 2010 Debugger

G.1. Introduction

G.2. Breakpoints and the Continue Command

G.3. DataTips and Visualizers

G.4. The Locals and Watch Windows

G.5. Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands

G.6. Other Debugging Features

G.6.1. Edit and Continue

G.6.1. Exception Assistant

G.6.2. Just My Code™ Debugging

G.6.3. Other Debugger Features

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset