| |  | Copyright |
| |  | Preface |
| |
|  | How This Book Is Different |
| |
|  | Who Should Read This Book? |
| |
|  | Overview of Chapters |
| |
|  | The Code Style Used in This Book |
| |
|  | From the Authors to You |
| |
|  | Acknowledgments |
| |
|  | About the Authors |
| |
|  | About the Technical Reviewers |
|
| |  | Part I.
C# Essentials |
| |
|  | Chapter 1.
The .NET Framework |
| |
|  |
Section 1.1.
What Is .NET? |
| |
|  |
Section 1.2.
.NET Framework Terminology and Core Concepts |
| |
|  |
Section 1.3.
CLR and the JVM |
| |
|  |
Section 1.4.
Memory Management |
| |
|  |
Section 1.5.
Security Management |
| |
|  |
Section 1.6.
Exception Management |
| |
|  |
Section 1.7.
Overview of the .NET Framework Class Library |
| |
|  |
Section 1.8.
Summary |
|
| |
|  | Chapter 2.
Starting with C# |
| |
|  |
Section 2.1.
The .NET SDK |
| |
|  |
Section 2.2.
Writing Your First C# Program |
| |
|  |
Section 2.3.
C# Performance |
| |
|  |
Section 2.4.
C# Tools |
| |
|  |
Section 2.5.
Summary |
|
| |
|  | Chapter 3.
C# and Java: What Is the Difference? |
| |
|  |
Section 3.1.
Programming Platforms (.NET and Java) |
| |
|  |
Section 3.2.
Runtime Architecture |
| |
|  |
Section 3.3.
The OOP Model |
| |
|  |
Section 3.4.
Language Constructs, Syntax, and the API |
| |
|  |
Section 3.5.
Summary |
|
| |
|  | Chapter 4.
Writing Objects |
| |
|  |
Section 4.1.
Object Creation |
| |
|  |
Section 4.2.
Classes |
| |
|  |
Section 4.3.
Constructors |
| |
|  |
Section 4.4.
Methods |
| |
|  |
Section 4.5.
Fields |
| |
|  |
Section 4.6.
Properties |
| |
|  |
Section 4.7.
Variable Scoping |
| |
|  |
Section 4.8.
Object Destruction |
| |
|  |
Section 4.9.
Summary |
|
| |
|  | Chapter 5.
Understanding Inheritance and Polymorphism |
| |
|  |
Section 5.1.
Inheritance |
| |
|  |
Section 5.2.
Polymorphism and Virtual Methods |
| |
|  |
Section 5.3.
Exploring C# Polymorphism |
| |
|  |
Section 5.4.
Methods and Inheritance |
| |
|  |
Section 5.5.
Casting |
| |
|  |
Section 5.6.
Composition versus Inheritance |
| |
|  |
Section 5.7.
Summary |
|
| |
|  | Chapter 6.
Implementing Interfaces |
| |
|  |
Section 6.1.
Basic Interfaces |
| |
|  |
Section 6.2.
Multiple Interfaces and Explicit Interface Declaration |
| |
|  |
Section 6.3.
Inheritance in Interfaces |
| |
|  |
Section 6.4.
The as Operator |
| |
|  |
Section 6.5.
Summary |
|
| |
|  | Chapter 7.
Data Types |
| |
|  |
Section 7.1.
The Java Value Type |
| |
|  |
Section 7.2.
The Java Reference Type |
| |
|  |
Section 7.3.
The C# Value Type |
| |
|  |
Section 7.4.
The Built-in Value Types |
| |
|  |
Section 7.5.
The C# Reference Types |
| |
|  |
Section 7.6.
Boxing and Unboxing |
| |
|  |
Section 7.7.
Unsafe Code |
| |
|  |
Section 7.8.
Summary |
|
| |
|  | Chapter 8.
Operators |
| |
|  |
Section 8.1.
Arithmetic Operators |
| |
|  |
Section 8.2.
Logical Operators |
| |
|  |
Section 8.3.
Bitwise Operators |
| |
|  |
Section 8.4.
String Concatenation Operators |
| |
|  |
Section 8.5.
The Increment and Decrement Operators |
| |
|  |
Section 8.6.
Shift Operators |
| |
|  |
Section 8.7.
Relational Operators |
| |
|  |
Section 8.8.
Assignment Operators |
| |
|  |
Section 8.9.
The Member Access (Dot) Operator |
| |
|  |
Section 8.10.
The Casting Operator |
| |
|  |
Section 8.11.
The Indexing Operator |
| |
|  |
Section 8.12.
The Conditional Operator |
| |
|  |
Section 8.13.
Object Creation Operator |
| |
|  |
Section 8.14.
Type Information Operators |
| |
|  |
Section 8.15.
Overflow Exception Control |
| |
|  |
Section 8.16.
Pointer Type Operators |
| |
|  |
Section 8.17.
Operator Precedence |
| |
|  |
Section 8.18.
Operator Overloading |
| |
|  |
Section 8.19.
Summary |
|
| |
|  | Chapter 9.
Essential Control Flow |
| |
|  |
Section 9.1.
The if Statement |
| |
|  |
Section 9.2.
The while Loop |
| |
|  |
Section 9.3.
The do while Loop |
| |
|  |
Section 9.4.
The for Loop |
| |
|  |
Section 9.5.
The switch Statement |
| |
|  |
Section 9.6.
The foreach Statement |
| |
|  |
Section 9.7.
Jump Statements |
| |
|  |
Section 9.8.
Summary |
|
| |
|  | Chapter 10.
Programming with Exceptions |
| |
|  |
Section 10.1.
Fundamentals of the try-catch-finally Construct |
| |
|  |
Section 10.2.
Custom Exceptions |
| |
|  |
Section 10.3.
Inheritance and Exceptions |
| |
|  |
Section 10.4.
CLR Exceptions |
| |
|  |
Section 10.5.
Design Considerations |
| |
|  |
Section 10.6.
Summary |
|
| |
|  | Chapter 11.
Working with Arrays |
| |
|  |
Section 11.1.
Java versus C# Arrays |
| |
|  |
Section 11.2.
One-Dimensional Arrays |
| |
|  |
Section 11.3.
Multidimensional Arrays |
| |
|  |
Section 11.4.
Jagged Arrays |
| |
|  |
Section 11.5.
Copying Arrays |
| |
|  |
Section 11.6.
Arrays as Collections |
| |
|  |
Section 11.7.
Summary |
|
| |
|  | Chapter 12.
Processing Strings |
| |
|  |
Section 12.1.
The System.String Class |
| |
|  |
Section 12.2.
Initializing Strings |
| |
|  |
Section 12.3.
The + Operator and Strings |
| |
|  |
Section 12.4.
Regular Expressions |
| |
|  |
Section 12.5.
Summary |
|
| |
|  | Chapter 13.
Formatting Numbers, Strings, and Dates |
| |
|  |
Section 13.1.
Formatting |
| |
|  |
Section 13.2.
Number Formatting |
| |
|  |
Section 13.3.
Date and Time Formatting |
| |
|  |
Section 13.4.
Formatting Custom Objects |
| |
|  |
Section 13.5.
Parsing |
| |
|  |
Section 13.6.
Summary |
|
| |
|  | Chapter 14.
Using Collections |
| |
|  |
Section 14.1.
The System.Collections Interfaces |
| |
|  |
Section 14.2.
The System.Collections Classes |
| |
|  |
Section 14.3.
Using the System.Collections Classes |
| |
|  |
Section 14.4.
Type-Safe Collections |
| |
|  |
Section 14.5.
Custom Collections |
| |
|  |
Section 14.6.
Summary |
|
| |
|  | Chapter 15.
Working with the C# I/O API |
| |
|  |
Section 15.1.
Streams |
| |
|  |
Section 15.2.
The FileStream Class |
| |
|  |
Section 15.3.
The BufferedStream Class |
| |
|  |
Section 15.4.
The MemoryStream Class |
| |
|  |
Section 15.5.
The NetworkStream Class |
| |
|  |
Section 15.6.
Readers and Writers |
| |
|  |
Section 15.7.
Files and Directories |
| |
|  |
Section 15.8.
Serialization |
| |
|  |
Section 15.9.
Summary |
|
| |
|  | Chapter 16.
Thread Programming |
| |
|  |
Section 16.1.
The System.Threading Namespace |
| |
|  |
Section 16.2.
Creating Threads Using the System.Threading.Thread Class |
| |
|  |
Section 16.3.
Stopping a Thread Safely in C# |
| |
|  |
Section 16.4.
Thread Synchronization |
| |
|  |
Section 16.5.
Interlocked Operations |
| |
|  |
Section 16.6.
Summary |
|
| |
|  | Chapter 17.
Using C# Properties, Indexers, and Attributes |
| |
|  |
Section 17.1.
Properties |
| |
|  |
Section 17.2.
Indexers |
| |
|  |
Section 17.3.
Attributes |
| |
|  |
Section 17.4.
Summary |
|
| |
|  | Chapter 18.
Delegates and Event Programming |
| |
|  |
Section 18.1.
Using Delegates |
| |
|  |
Section 18.2.
Multicasting |
| |
|  |
Section 18.3.
Event Programming |
| |
|  |
Section 18.4.
Summary |
|
|
| |  | Part II.
Advanced C# Topics |
| |
|  | Chapter 19.
Accessing Databases |
| |
|  |
Section 19.1.
Inside ADO.NET |
| |
|  |
Section 19.2.
JDBC 2.0+ |
| |
|  |
Section 19.3.
Getting Started with ADO.NET |
| |
|  |
Section 19.4.
DataSets |
| |
|  |
Section 19.5.
Summary |
|
| |
|  | Chapter 20.
Processing XML |
| |
|  |
Section 20.1.
XML Support in Java |
| |
|  |
Section 20.2.
XML and .NET |
| |
|  |
Section 20.3.
Reading and Writing XML |
| |
|  |
Section 20.4.
Using the DOM API in .NET |
| |
|  |
Section 20.5.
Summary |
|
| |
|  | Chapter 21.
GUI Programming in C# |
| |
|  |
Section 21.1.
Choosing a GUI Library: Java or .NET? |
| |
|  |
Section 21.2.
Using the IDE to Develop a Small Application |
| |
|  |
Section 21.3.
Windows Forms, Component Controls, and Their Associated .NET Classes |
| |
|  |
Section 21.4.
Putting It All Together |
| |
|  |
Section 21.5.
Anchoring and Docking |
| |
|  |
Section 21.6.
Drawing with .NET GUI Classes |
| |
|  |
Section 21.7.
Summary |
|
| |
|  | Chapter 22.
Reflection |
| |
|  |
Section 22.1.
The Core Reflection Classes |
| |
|  |
Section 22.2.
Browsing and Querying Members |
| |
|  |
Section 22.3.
Invoking Methods and Setting Fields and Properties |
| |
|  |
Section 22.4.
Generating Dynamic IL Using Reflection Emit |
| |
|  |
Section 22.5.
Summary |
|
| |
|  | Chapter 23.
Assemblies, Application Configuration, and Process Management |
| |
|  |
Section 23.1.
The .NET Assembly |
| |
|  |
Section 23.2.
Creating an Assembly |
| |
|  |
Section 23.3.
Programmatic Access to Assemblies |
| |
|  |
Section 23.4.
Versioning |
| |
|  |
Section 23.5.
Application Configuration |
| |
|  |
Section 23.6.
Process Management |
| |
|  |
Section 23.7.
Summary |
|
| |
|  | Appendix Java and C# API Comparison |
| |
|  |
Section A.1.
The java.lang Package |
| |
|  |
Section A.2.
The java.util Package |
| |
|  |
Section A.3.
The java.io Package |
| |
|  |
Section A.4.
The java.sql Package |
| |
|  |
Section A.5.
The java.text Package |
| |
|  |
Section A.6.
The org.w3c.dom Package |
| |
|  |
Section A.7.
The javax.swing Package |
| |
|  |
Section A.8.
The java.awt Package |
|
|