| |
| |
Preface | |
| |
| |
| |
Introducing C# and .NET | |
| |
| |
| |
What Is C#? | |
| |
| |
| |
What Is the .NET Framework? | |
| |
| |
| |
The .NET Virtual Machine: Common Language Runtime | |
| |
| |
| |
The .NET Virtual Code: Intermediate Language | |
| |
| |
| |
The .NET Assemblies: Applications and/or Components | |
| |
| |
| |
Project Exercise | |
| |
| |
| |
Syntax Notation | |
| |
| |
| |
Classes, Objects, and Namespaces | |
| |
| |
| |
Classes and Objects | |
| |
| |
| |
Declaring Classes | |
| |
| |
| |
Creating Objects | |
| |
| |
| |
Access Modifiers | |
| |
| |
| |
Controlling Access to Classes | |
| |
| |
| |
Controlling Access to Class Members | |
| |
| |
| |
Namespaces | |
| |
| |
| |
Declaring Namespaces | |
| |
| |
| |
Importing Namespaces | |
| |
| |
| |
Controlling the Global Namespace | |
| |
| |
| |
Resolving Namespace Conflicts | |
| |
| |
| |
Compilation Units | |
| |
| |
| |
Presenting a Complete C# Program | |
| |
| |
| |
Declaring Partial Classes | |
| |
| |
| |
Compilation and Execution | |
| |
| |
| |
Using Assemblies for Separate Compilation | |
| |
| |
| |
Revisiting Access Modifiers | |
| |
| |
| |
Adding XML Documentation | |
| |
| |
| |
Class Members and Class Reuse | |
| |
| |
| |
Fields and Methods | |
| |
| |
| |
Invoking Methods | |
| |
| |
| |
Accessing Fields | |
| |
| |
| |
Declaring Constructors | |
| |
| |
| |
Declaring Destructors | |
| |
| |
| |
Parameter Passing | |
| |
| |
| |
Passing Arguments by Value | |
| |
| |
| |
Passing Arguments by Reference | |
| |
| |
| |
Passing a Variable Number of Arguments | |
| |
| |
| |
Using the this Reference | |
| |
| |
| |
Overloading Methods | |
| |
| |
| |
Class Reuse | |
| |
| |
| |
Using Aggregation | |
| |
| |
| |
Using Inheritance | |
| |
| |
| |
Comparing Aggregation and Inheritance | |
| |
| |
| |
Using Protected Methods | |
| |
| |
| |
Unified Type System | |
| |
| |
| |
Reference Types | |
| |
| |
| |
Value Types | |
| |
| |
| |
Simple Value Types | |
| |
| |
| |
Nullable Types | |
| |
| |
| |
Structure Types | |
| |
| |
| |
Enumeration Types | |
| |
| |
| |
Literals | |
| |
| |
| |
Conversions | |
| |
| |
| |
Boxing and Unboxing | |
| |
| |
| |
The Object Root Class | |
| |
| |
| |
Calling Virtual Methods | |
| |
| |
| |
Invoking the Object Constructor | |
| |
| |
| |
Using Object Instance Methods | |
| |
| |
| |
Using Object Static Methods | |
| |
| |
| |
Arrays | |
| |
| |
| |
Creating and Initializing Arrays | |
| |
| |
| |
Accessing Arrays | |
| |
| |
| |
Using Rectangular and Jagged Arrays | |
| |
| |
| |
Strings | |
| |
| |
| |
Invoking String Methods | |
| |
| |
| |
Concat, IndexOf, and Substring Methods | |
| |
| |
| |
The StringBuilder Class | |
| |
| |
| |
Operators, Assignments, and Expressions | |
| |
| |
| |
Operator Precedence and Associativity | |
| |
| |
| |
Assignment Operators | |
| |
| |
| |
Simple Assignment | |
| |
| |
| |
Multiple Assignments | |
| |
| |
| |
Conditional Operator | |
| |
| |
| |
Null Coalescing Operator | |
| |
| |
| |
Conditional Logical Operators | |
| |
| |
| |
Logical Operators | |
| |
| |
| |
Logical Operators as Conditional Logical Operators | |
| |
| |
| |
Compound Logical Assignment Operators | |
| |
| |
| |
Equality Operators | |
| |
| |
| |
Simple Value Type Equality | |
| |
| |
| |
Object Reference and Value Equality | |
| |
| |
| |
Relational Operators | |
| |
| |
| |
Type Testing | |
| |
| |
| |
Shift Operators | |
| |
| |
| |
Compound Shift Assignment Operators | |
| |
| |
| |
Arithmetic Operators | |
| |
| |
| |
Multiplicative Operators | |
| |
| |
| |
Additive Operators | |
| |
| |
| |
checked/unchecked Operators | |
| |
| |
| |
Compound Arithmetic Assignment Operators | |
| |
| |
| |
Unary Operators | |
| |
| |
| |
Prefix and Postfix Operators | |
| |
| |
| |
Explicit Casts | |
| |
| |
| |
Other Primary Operators | |
| |
| |
| |
Overloadable Operators | |
| |
| |
| |
Statements and Exceptions | |
| |
| |
| |
Block Statement | |
| |
| |
| |
Declaration Statements | |
| |
| |
| |
Embedded Statements | |
| |
| |
| |
Expression and Empty Statements | |
| |
| |
| |
Selection Statements | |
| |
| |
| |
Iteration Statements | |
| |
| |
| |
Jump Statements | |
| |
| |
| |
checked/unchecked Statements | |
| |
| |
| |
lock and using Statements | |
| |
| |
| |
Exceptions and Exception Handling | |
| |
| |
| |
What Is an Exception? | |
| |
| |
| |
Raising and Handling Exceptions | |
| |
| |
| |
Using the throw Statement | |
| |
| |
| |
Using the try-catch Statement | |
| |
| |
| |
An Extended Example | |
| |
| |
| |
Advanced Types, Polymorphism, and Accessors | |
| |
| |
| |
Delegates and Events | |
| |
| |
| |
Using Delegates for Callbacks | |
| |
| |
| |
Using Delegates for Events | |
| |
| |
| |
Using Delegates for Anonymous Methods | |
| |
| |
| |
Using Delegate Inferences | |
| |
| |
| |
Abstract Classes | |
| |
| |
| |
Declaring Abstract Classes | |
| |
| |
| |
Implementing Abstract Classes | |
| |
| |
| |
Using Abstract Classes | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Declaring Interfaces | |
| |
| |
| |
Implementing Interfaces | |
| |
| |
| |
Using Interface Methods | |
| |
| |
| |
Polymorphism and Virtual Methods | |
| |
| |
| |
Using the Modifiers override and virtual | |
| |
| |
| |
Adding and Removing Polymorphism | |
| |
| |
| |
Using Dynamic Binding | |
| |
| |
| |
Properties | |
| |
| |
| |
Declaring get and set Accessors | |
| |
| |
| |
Declaring Virtual and Abstract Properties | |
| |
| |
| |
Declaring Static Properties | |
| |
| |
| |
Declaring Properties with Accessor Modifiers | |
| |
| |
| |
Indexers | |
| |
| |
| |
Nested Types | |
| |
| |
| |
Other Modifiers | |
| |
| |
| |
Collections and Generics | |
| |
| |
| |
Collections | |
| |
| |
| |
Cloning Collections | |
| |
| |
| |
Using List-Type Collections | |
| |
| |
| |
Using Dictionary-Type Collections | |
| |
| |
| |
Using Iterator Blocks and yield Statements | |
| |
| |
| |
Generics | |
| |
| |
| |
Defining Generics | |
| |
| |
| |
Declaring Generic Objects | |
| |
| |
| |
Resource Disposal, Input/Output, and Threads | |
| |
| |
| |
Resource Disposal | |
| |
| |
| |
Input/Output | |
| |
| |
| |
Using Binary Streams | |
| |
| |
| |
Using Byte Streams | |
| |
| |
| |
Using Character Streams | |
| |
| |
| |
Reading XML Documents from Streams | |
| |
| |
| |
Threads | |
| |
| |
| |
Examining the Thread Class and Thread States | |
| |
| |
| |
Creating and Starting Threads | |
| |
| |
| |
Rescheduling and Pausing Threads | |
| |
| |
| |
Suspending, Resuming, and Stopping Threads | |
| |
| |
| |
Joining and Determining Alive Threads | |
| |
| |
| |
Synchronizing Threads | |
| |
| |
| |
Reflection and Attributes | |
| |
| |
| |
Reflection | |
| |
| |
| |
Examining the Reflection Hierarchy | |
| |
| |
| |
Accessing Assemblies | |
| |
| |
| |
Attributes | |
| |
| |
| |
Using Attributes for Exception Serialization | |
| |
| |
| |
Using Attributes for Conditional Compilation | |
| |
| |
| |
Using Attributes for Obsolete Code | |
| |
| |
| |
Defining User-Defined Attributes | |
| |
| |
| |
Using User-Defined Attributes | |
| |
| |
| |
Extracting Attributes Using Reflection | |
| |
| |
| |
Where to Go from Here | |
| |
| |
| |
C# 2.0 Grammar | |
| |
| |
| |
Lexical Grammar | |
| |
| |
| |
Line Terminators | |
| |
| |
| |
White Space | |
| |
| |
| |
Comments | |
| |
| |
| |
Tokens | |
| |
| |
| |
Unicode Character Escape Sequences | |
| |
| |
| |
Identifiers | |
| |
| |
| |
Keywords | |
| |
| |
| |
Literals | |
| |
| |
| |
Operators and Punctuators | |
| |
| |
| |
Preprocessing Directives | |
| |
| |
| |
Syntactic Grammar | |
| |
| |
| |
Namespace, Type, and Simple Names | |
| |
| |
| |
Types | |
| |
| |
| |
Variables | |
| |
| |
| |
Expressions | |
| |
| |
| |
Statements | |
| |
| |
| |
Namespaces | |
| |
| |
| |
Classes | |
| |
| |
| |
Structs | |
| |
| |
| |
Arrays | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Enums | |
| |
| |
| |
Delegates | |
| |
| |
| |
Attributes | |
| |
| |
| |
Generics | |
| |
| |
| |
Predefined XML Tags for Documentation Comments | |
| |
| |
References | |
| |
| |
Index | |