Preface | p. xv |
C# Fundamentals | p. 1 |
C#'s Family Tree | p. 2 |
C: The Beginning of the Modern Age of Programming | p. 2 |
The Creation of OOP and C++ | p. 3 |
The Internet and Java Emerge | p. 4 |
The Creation of C# | p. 5 |
How C# Relates to the .NET Framework | p. 7 |
What Is the .NET Framework? | p. 7 |
How the Common Language Runtime Works | p. 8 |
Managed vs. Unmanaged Code | p. 9 |
The Common Language Specification | p. 9 |
Object-Oriented Programming | p. 10 |
Encapsulation | p. 11 |
Polymorphism | p. 12 |
Inheritance | p. 13 |
A First Simple Program | p. 14 |
Using csc.exe, the C# Command-Line Compiler | p. 15 |
Using the Visual C++ IDE | p. 16 |
The First Sample Program Line by Line | p. 21 |
Handling Syntax Errors | p. 25 |
A Small Variation | p. 26 |
A Second Simple Program | p. 27 |
Another Data Type | p. 29 |
Converting Fahrenheit to Celsius | p. 32 |
Two Control Statements | p. 33 |
The if Statement | p. 34 |
The for Loop | p. 36 |
Using Blocks of Code | p. 38 |
Semicolons and Positioning | p. 39 |
Indentation Practices | p. 40 |
Improving the Temperature Conversion Program | p. 41 |
The C# Keywords | p. 42 |
Identifiers | p. 43 |
The C# Class Library | p. 44 |
Mastery Check | p. 45 |
Introducing Data Types and Operators | p. 47 |
Why Data Types Are Important | p. 48 |
C#'s Value Types | p. 48 |
Integers | p. 49 |
Floating-Point Types | p. 52 |
The decimal Type | p. 53 |
Characters | p. 54 |
The bool Type | p. 56 |
Some Output Options | p. 57 |
Talking to Mars | p. 60 |
Literals | p. 62 |
Hexadecimal Literals | p. 63 |
Character Escape Sequences | p. 63 |
String Literals | p. 64 |
A Closer Look at Variables | p. 67 |
Initializing a Variable | p. 67 |
Dynamic Initialization | p. 68 |
The Scope and Lifetime of Variables | p. 68 |
Operators | p. 72 |
Arithmetic Operators | p. 72 |
Increment and Decrement | p. 74 |
Relational and Logical Operators | p. 75 |
Short-Circuit Logical Operators | p. 77 |
Display a Truth Table for the Logical Operators | p. 78 |
The Assignment Operator | p. 82 |
Compound Assignments | p. 82 |
Type Conversion in Assignments | p. 83 |
Casting Incompatible Types | p. 85 |
Operator Precedence | p. 87 |
Expressions | p. 88 |
Type Conversion in Expressions | p. 88 |
Spacing and Parentheses | p. 92 |
Compute the Regular Payments on a Loan | p. 92 |
Mastery Check | p. 96 |
Program Control Statements | p. 99 |
Inputting Characters from the Keyboard | p. 100 |
The if Statement | p. 101 |
Nested ifs | p. 103 |
The if-else-if Ladder | p. 104 |
The switch Statement | p. 106 |
Nested switch Statements | p. 111 |
Start Building a C# Help System | p. 112 |
The for Loop | p. 115 |
Some Variations on the for Loop | p. 117 |
Missing Pieces | p. 118 |
Loops with No Body | p. 120 |
Declaring Loop Control Variables Inside the for Loop | p. 121 |
The while Loop | p. 123 |
The do-while Loop | p. 125 |
Improve the C# Help System | p. 128 |
Using break to Exit a Loop | p. 131 |
Using continue | p. 133 |
The goto | p. 134 |
Finish the C# Help System | p. 136 |
Nested Loops | p. 141 |
Mastery Check | p. 143 |
Introducing Classes, Objects, and Methods | p. 145 |
Class Fundamentals | p. 146 |
The General Form of a Class | p. 146 |
Defining a Class | p. 148 |
How Objects Are Created | p. 153 |
Reference Variables and Assignment | p. 154 |
Methods | p. 155 |
Adding a Method to the Vehicle Class | p. 156 |
Returning from a Method | p. 159 |
Returning a Value | p. 160 |
Using Parameters | p. 163 |
Adding a Parameterized Method to Vehicle | p. 165 |
Creating a Help Class | p. 167 |
Constructors | p. 174 |
Parameterized Constructors | p. 176 |
Adding a Constructor to the Vehicle Class | p. 177 |
The new Operator Revisited | p. 179 |
Garbage Collection and Destructors | p. 180 |
Destructors | p. 181 |
Demonstrate Destructors | p. 181 |
The this Keyword | p. 184 |
Mastery Check | p. 187 |
More Data Types and Operators | p. 189 |
Arrays | p. 190 |
One-Dimensional Arrays | p. 190 |
Sorting an Array | p. 196 |
Multidimensional Arrays | p. 198 |
Two-Dimensional Arrays | p. 198 |
Arrays of Three or More Dimensions | p. 200 |
Initializing Multidimensional Arrays | p. 200 |
Jagged Arrays | p. 202 |
Assigning Array References | p. 205 |
Using the Length Property | p. 206 |
A Queue Class | p. 209 |
The foreach Loop | p. 214 |
Strings | p. 217 |
Constructing Strings | p. 218 |
Operating on Strings | p. 218 |
Arrays of Strings | p. 221 |
Strings Are Immutable | p. 222 |
The Bitwise Operators | p. 224 |
The Bitwise AND, OR, XOR, and NOT Operators | p. 224 |
The Shift Operators | p. 230 |
Bitwise Compound Assignments | p. 232 |
A ShowBits Class | p. 232 |
The ? Operator | p. 239 |
Mastery Check | p. 239 |
A Closer Look at Methods and Classes | p. 241 |
Controlling Access to Class Members | p. 242 |
C#'s Access Specifiers | p. 242 |
Improving the Queue Class | p. 248 |
Pass Objects to Methods | p. 250 |
How Arguments Are Passed | p. 252 |
Using ref and out Parameters | p. 255 |
Using ref | p. 255 |
Using out | p. 257 |
Using a Variable Number of Arguments | p. 261 |
Returning Objects | p. 265 |
Method Overloading | p. 267 |
Overloading Constructors | p. 275 |
Invoking an Overloaded Constructor Through this | p. 277 |
Overloading the Queue Constructor | p. 279 |
The Main() Method | p. 283 |
Returning Values from Main() | p. 283 |
Passing Arguments to Main() | p. 283 |
Recursion | p. 286 |
Understanding static | p. 289 |
The Quicksort | p. 293 |
Mastery Check | p. 297 |
Operator Overloading, Indexers, and Properties | p. 299 |
Operator Overloading | p. 300 |
The General Forms of an Operator Method | p. 300 |
Overloading Binary Operators | p. 301 |
Overloading Unary Operators | p. 304 |
Adding Flexibility | p. 309 |
Overloading the Relational Operators | p. 315 |
Operator Overloading Tips and Restrictions | p. 317 |
Indexers | p. 319 |
Multidimensional Indexers | p. 325 |
Properties | p. 328 |
Property Restrictions | p. 333 |
Creating a Set Class | p. 333 |
Mastery Check | p. 344 |
Inheritance | p. 345 |
Inheritance Basics | p. 346 |
Member Access and Inheritance | p. 350 |
Using Protected Access | p. 353 |
Constructors and Inheritance | p. 355 |
Calling Base Class Constructors | p. 357 |
Inheritance and Name Hiding | p. 363 |
Using base to Access a Hidden Name | p. 364 |
Extending the Vehicle Class | p. 367 |
Creating a Multilevel Hierarchy | p. 371 |
When Are Constructors Called? | p. 374 |
Base Class References and Derived Objects | p. 376 |
Virtual Methods and Overriding | p. 382 |
Why Overridden Methods? | p. 385 |
Applying Virtual Methods | p. 386 |
Using Abstract Classes | p. 391 |
Using sealed to Prevent Inheritance | p. 396 |
The object Class | p. 396 |
Boxing and Unboxing | p. 399 |
Mastery Check | p. 402 |
Interfaces, Structures, and Enumerations | p. 403 |
Interfaces | p. 404 |
Implementing Interfaces | p. 405 |
Using Interface References | p. 410 |
Creating a Queue Interface | p. 413 |
Interface Properties | p. 419 |
Interface Indexers | p. 421 |
Interfaces Can Be Inherited | p. 424 |
Explicit Implementations | p. 426 |
Structures | p. 430 |
Enumerations | p. 432 |
Initialize an Enumeration | p. 434 |
Specifying the Base Type of an Enumeration | p. 435 |
Mastery Check | p. 436 |
Exception Handling | p. 437 |
The System.Exception Class | p. 438 |
Exception Handling Fundamentals | p. 439 |
Using try and catch | p. 439 |
A Simple Exception Example | p. 440 |
A Second Exception Example | p. 441 |
The Consequences of an Uncaught Exception | p. 443 |
Exceptions Let You Handle Errors Gracefully | p. 445 |
Using Multiple catch Statements | p. 446 |
Catching All Exceptions | p. 448 |
Try Blocks Can Be Nested | p. 449 |
Throwing an Exception | p. 450 |
Rethrowing an Exception | p. 452 |
Using finally | p. 453 |
A Closer Look at Exception | p. 455 |
Commonly Used Exceptions | p. 457 |
Deriving Exception Classes | p. 458 |
Catching Derived Class Exceptions | p. 460 |
Adding Exceptions to the Queue Class | p. 462 |
Using checked and unchecked | p. 466 |
Mastery Check | p. 470 |
Using I/O | p. 471 |
C#'s I/O Is Built upon Streams | p. 472 |
Byte Streams and Character Streams | p. 472 |
The Predefined Streams | p. 473 |
The Stream Classes | p. 473 |
The Stream Class | p. 474 |
The Byte Stream Classes | p. 475 |
The Character Stream Wrapper Classes | p. 475 |
Binary Streams | p. 477 |
Console I/O | p. 478 |
Reading Console Input | p. 478 |
Writing Console Output | p. 480 |
FileStream and Byte-Oriented File I/O | p. 481 |
Opening and Closing a File | p. 481 |
Reading Bytes from a FileStream | p. 483 |
Writing to a File | p. 485 |
Character-Based File I/O | p. 488 |
Using StreamWriter | p. 488 |
Using a StreamReader | p. 491 |
Redirecting the Standard Streams | p. 492 |
A File Comparison Utility | p. 495 |
Reading and Writing Binary Data | p. 497 |
BinaryWriter | p. 498 |
BinaryReader | p. 499 |
Demonstrating Binary I/O | p. 500 |
Random Access Files | p. 502 |
Converting Numeric Strings to Their Internal Representation | p. 505 |
Creating a Disk-Based Help System | p. 511 |
Mastery Check | p. 518 |
Delegates, Events, Namespaces, and Advanced Topics | p. 519 |
Delegates | p. 520 |
Multicasting | p. 525 |
Why Delegates | p. 528 |
Events | p. 528 |
A Multicast Event Example | p. 531 |
Namespaces | p. 535 |
Declaring a Namespace | p. 535 |
Using | p. 538 |
A Second Form of using | p. 540 |
Namespaces Are Additive | p. 542 |
Namespaces Can Be Nested | p. 544 |
The Default Namespace | p. 545 |
Putting Set into a Namespace | p. 546 |
Conversion Operators | p. 549 |
The Preprocessor | p. 555 |
#define | p. 555 |
#if and #endif | p. 556 |
#else and #elif | p. 558 |
#undef | p. 560 |
#error | p. 561 |
#warning | p. 561 |
#line | p. 561 |
#region and #endregion | p. 562 |
Attributes | p. 562 |
The Conditional Attribute | p. 563 |
The Obsolete Attribute | p. 564 |
Unsafe Code | p. 565 |
A Brief Look at Pointers | p. 566 |
Using unsafe | p. 569 |
Using fixed | p. 570 |
Runtime Type Identification | p. 571 |
Testing a Type with is | p. 571 |
Using as | p. 573 |
Using typeof | p. 573 |
Other Keywords | p. 574 |
The internal Access Modifier | p. 574 |
sizeof | p. 574 |
lock | p. 575 |
readonly | p. 575 |
stackalloc | p. 576 |
The using Statement | p. 576 |
const and volatile | p. 577 |
What Next? | p. 577 |
Mastery Check | p. 578 |
Answers to Mastery Checks | p. 579 |
C# Fundamentals | p. 580 |
Introducing Data Types and Operators | p. 581 |
Program Control Statements | p. 583 |
Introducing Classes, Objects, and Methods | p. 587 |
More Data Types and Operators | p. 588 |
A Closer Look at Methods and Classes | p. 591 |
Operator Overloading, Indexers, and Properties | p. 597 |
Inheritance | p. 599 |
Interfaces, Structures, and Enumerations | p. 601 |
Exception Handling | p. 605 |
Using I/O | p. 608 |
Delegates, Events, Namespaces, and Advanced Topics | p. 611 |
Index | p. 613 |
Table of Contents provided by Syndetics. All Rights Reserved. |