| |
| |
Acknowledgments | |
| |
| |
Introduction | |
| |
| |
Who This Book Is For | |
| |
| |
Finding Your Best Starting Point in This Book | |
| |
| |
Conventions and Features in This Book | |
| |
| |
System Requirements | |
| |
| |
Code Samples | |
| |
| |
Uninstalling the Code Samples | |
| |
| |
Support for This Book; | |
| |
| |
| |
Introducing Microsoft Visual C# and Microsoft Visual Studio 2008 | |
| |
| |
| |
Welcome to C# | |
| |
| |
| |
Beginning Programming with the Visual Studio 2008 Environment | |
| |
| |
| |
Writing Your First Program | |
| |
| |
| |
Using Namespaces | |
| |
| |
| |
Creating a Graphical Application | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Working with Variables, Operators, and Expressions | |
| |
| |
| |
Understanding Statements | |
| |
| |
| |
Using Identifiers | |
| |
| |
| |
Identifying Keywords | |
| |
| |
| |
Using Variables | |
| |
| |
| |
Working with Primitive Data Types | |
| |
| |
| |
Using Arithmetic Operators | |
| |
| |
| |
Incrementing and Decrementing Variables | |
| |
| |
| |
Declaring Implicitly Typed Local Variables | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Writing Methods and Applying Scope | |
| |
| |
| |
Declaring Methods | |
| |
| |
| |
Applying Scope | |
| |
| |
| |
Writing Methods | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Using Decision Statements | |
| |
| |
| |
Declaring Boolean Variables | |
| |
| |
| |
Using Boolean Operators | |
| |
| |
| |
Using if Statements to Make Decisions | |
| |
| |
| |
Using switch Statements | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Using Compound Assignment and Iteration Statements | |
| |
| |
| |
Using Compound Assignment Operators | |
| |
| |
| |
Writing while Statements | |
| |
| |
| |
Writing for Statements | |
| |
| |
| |
Writing do Statements | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Managing Errors and Exceptions | |
| |
| |
| |
Coping with Errors | |
| |
| |
| |
Trying Code and Catching Exceptions | |
| |
| |
| |
Using Checked and Unchecked Integer Arithmetic | |
| |
| |
| |
Throwing Exceptions | |
| |
| |
| |
Using a finally Block | |
| |
| |
| |
Quick Reference; | |
| |
| |
| |
Understanding the C# Language | |
| |
| |
| |
Creating and Managing Classes and Objects | |
| |
| |
| |
Understanding Classification | |
| |
| |
| |
The Purpose of Encapsulation | |
| |
| |
| |
Defining and Using a Class | |
| |
| |
| |
Controlling Accessibility | |
| |
| |
| |
Working with Constructors | |
| |
| |
| |
Understanding static Methods and Data | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Understanding Values and References | |
| |
| |
| |
Copying Value Type Variables and Classes | |
| |
| |
| |
Understanding Null Values and Nullable Types | |
| |
| |
| |
Using ref and out Parameters | |
| |
| |
| |
How Computer Memory Is Organized | |
| |
| |
| |
The System.Object Class | |
| |
| |
| |
Boxing | |
| |
| |
| |
Unboxing | |
| |
| |
| |
Casting Data Safely | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Creating Value Types with Enumerations and Structures | |
| |
| |
| |
Working with Enumerations | |
| |
| |
| |
Working with Structures | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Using Arrays and Collections | |
| |
| |
| |
What Is an Array? | |
| |
| |
| |
Initializing Array Variables | |
| |
| |
| |
What Are Collection Classes? | |
| |
| |
| |
The SortedList Collection Class | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Understanding Parameter Arrays | |
| |
| |
| |
Using Array Arguments | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Working with Inheritance | |
| |
| |
| |
What Is Inheritance? | |
| |
| |
| |
Using Inheritance | |
| |
| |
| |
Understanding Extension Methods | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Creating Interfaces and Defining Abstract Classes | |
| |
| |
| |
Understanding Interfaces | |
| |
| |
| |
Interface Restrictions | |
| |
| |
| |
Abstract Classes | |
| |
| |
| |
Sealed Classes | |
| |
| |
| |
Implementing an Extensible Framework | |
| |
| |
| |
Summarizing Keyword Combinations | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Using Garbage Collection and Resource Management | |
| |
| |
| |
The Life and Times of an Object | |
| |
| |
| |
Resource Management | |
| |
| |
| |
Making Code Exception-Safe | |
| |
| |
| |
Quick Reference; | |
| |
| |
| |
Creating Components | |
| |
| |
| |
Implementing Properties to Access Fields | |
| |
| |
| |
Implementing Encapsulation by Using Methods | |
| |
| |
| |
What Are Properties? | |
| |
| |
| |
Understanding the Property Restrictions | |
| |
| |
| |
Declaring Interface Properties | |
| |
| |
| |
Generating Automatic Properties | |
| |
| |
| |
Initializing Objects by Using Properties | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Using Indexers | |
| |
| |
| |
What Is an Indexer? | |
| |
| |
| |
Indexers in Interfaces | |
| |
| |
| |
Using Indexers in a Windows Application | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Interrupting Program Flow and Handling Events | |
| |
| |
| |
Declaring and Using Delegates | |
| |
| |
| |
Lambda Expressions and Delegates | |
| |
| |
| |
Enabling Notifications with Events | |
| |
| |
| |
Unsubscribing from an Event | |
| |
| |
| |
Understanding WPF User Interface Events | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Introducing Generics | |
| |
| |
| |
The Problem with objects | |
| |
| |
| |
The Generics Solution | |
| |
| |
| |
Creating a Generic Class | |
| |
| |
| |
Creating a Generic Method | |
| |
| |
| |
Quick reference | |
| |
| |
| |
Enumerating Collections | |
| |
| |
| |
Enumerating the Elements in a Collection | |
| |
| |
| |
Implementing an Enumerator by Using an Iterator | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Querying In-Memory Data by Using Query Expressions | |
| |
| |
| |
What Is Language Integrated Query (LINQ)? | |
| |
| |
| |
Usinnnnnng LINQ in a C# Application | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Operator Overloading | |
| |
| |
| |
Understanding Operators | |
| |
| |
| |
Understanding Compound Assignment | |
| |
| |
| |
Declaring Increment and Decrement Operators | |
| |
| |
| |
Defining Operator Pairs | |
| |
| |
| |
Implementing an Operator | |
| |
| |
| |
Understanding Conversion Operators | |
| |
| |
| |
Quick Reference; | |
| |
| |
| |
Working with Windows Applications | |
| |
| |
| |
Introducing Windows Presentation Foundation | |
| |
| |
| |
Creating a WPF Application | |
| |
| |
| |
Adding Controls to the Form | |
| |
| |
| |
Handling Events in a WPF Form | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Working with Menus and Dialog Boxes | |
| |
| |
| |
Menu Guidelines and Style | |
| |
| |
| |
Menus and Menu Events | |
| |
| |
| |
Shortcut Menus | |
| |
| |
| |
Windows Common Dialog Boxes | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Performing Validation | |
| |
| |
| |
Validating Data | |
| |
| |
| |
An Example—Customer Information Maintenance | |
| |
| |
| |
Quick Reference; | |
| |
| |
| |
Managing Data | |
| |
| |
| |
Querying Information in a Database | |
| |
| |
| |
Querying a Database by Using ADO.NET | |
| |
| |
| |
Querying a Database by Using DLINQ | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Displaying and Editing Data by Using Data Binding | |
| |
| |
| |
Using Data Binding with DLINQ | |
| |
| |
| |
Using DLINQ to Modify Data | |
| |
| |
| |
Quick Reference; | |
| |
| |
| |
Building Web Applications | |
| |
| |
| |
Introducing ASP.NET | |
| |
| |
| |
Understanding the Internet as an Infrastructure | |
| |
| |
| |
Creating Web Applications with ASP.NET | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Understanding Web Forms Validation Controls | |
| |
| |
| |
Comparing Server and Client Validations | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Protecting a Web Site and Accessing Data with Web Forms | |
| |
| |
| |
Managing Security | |
| |
| |
| |
Querying and Displaying Data | |
| |
| |
| |
Editing Data | |
| |
| |
| |
Navigating Between Forms | |
| |
| |
| |
Quick Reference | |
| |
| |
| |
Creating and Using a Web Service | |
| |
| |
| |
What Is a Web Service? | |
| |
| |
| |
Building a Web Service | |
| |
| |
| |
Web Services, Clients, and Proxies | |
| |
| |
| |
Quick Reference; | |