C# Programming Long Table of Contents
(with page numbers)
Chapter 1 — An Introduction 1
Basics of C# Programming 4
Getting Started — The Hello World Program 5
The Hello World Program as a Windows Forms Application 8
Chapter 2 — Language Elements 16
Data Types 16
Boxing and Unboxing 18
Some System.Object Functions 18
The Inputting and Outputting of Data 19
Math and Comparison Operations 23
Looping Instructions 25
The while Statement 25
The for Statement 26
The do until Statement 26
The break and continue Statements 26
The Do Case Statement 27
Math Functions 27
Data Conversions 28
Functions and Passing by Value Versus Passing by Reference 29
The ref and out Reference Variables 30
A Beginning Look At Classes 32
Scope and Duration (Lifetime) of Variables 34
Programming Problem 38
Chapter 3 — Arrays, Strings, and Classes 39
Single Dimensioned Arrays 39
The foreach Statement 43
Multiple Dimensioned Arrays 44
Jagged Arrays 45
Arrays of Reference Variables 46
Strings 47
Some Additional Class Features — Properties 49
Constant Data Items 52
Static Properties — Static Member Functions — Static Constructors — ReadOnly Fields 52
Enumerations 54
Indexers — Smart Array Accessors 56
Problems 60
Chapter 4 OOP — Inheritance, Polymorphism, and Operator Overloading 61
Class Accessibility 61
Principles of Inheritance 61
Inherited Methods and References to Base Class 67
Using base From Other Locations 74
Destructors, Object.Finalize, and Garbage Collection 75
Conversions From Base Class to Derived Class And Vice Versa 76
Abstract Base Classes 77
Sealed Classes and Methods 84
Operator Overloading 85
Problems 89
Chapter 5 — Exception Handling, Interfaces, Delegates and Event Handling 91
Exception Handling 91
Our Handling of Exceptions 94
The finally clause 97
Design Issues with the try Block 98
Design Issues with the catch Block 98
Quadratic — a Practical Example 99
Interfaces 103
Delegates 105
Multicasting of Delegates 107
Events 108
Chapter 6 — The Windows User Interface 110
The Basics of the Windows User Interface 110
Event Handling 119
Message Boxes 120
Responding to Button Presses 122
Other Properties and Events 123
Mouse Events 124
Making the Find Matching Cars Actually Work 124
Problems 130
Chapter 7 — Files and Container Classes 131
Console Stream Objects 131
File Objects 131
The Common File Dialogs 134
Defining the File Stream — For All Three Methods 135
Text I/O Operations 136
The Purchase Class 138
Binary File I/O 140
Serialization/Deserialization of a Class 141
The Window’s Programming Techniques of Data Transfer To Controls 142
Commentary on the Difference Between Binary and Serialized Data Files 149
Data Structures or Collection Classes or Container Classes 150
Array Class 150
Way 1. Add two sort classes derived IComparer from to the Purchase class 151
Way 2. Make IComparer a Property 152
The Collections 152
A Practical Example — ConsoleApplication10 154
Problems 157
Chapter 8 — Advanced GUI Features 159
Menus 161
Adding Additional cs Files 163
The List View Control and File Open and Save 163
OnOpen 166
OnFileSave 168
OnUpdate Process 169
Making Dialog Classes 170
Handling the Delete Operation 174
Tracking Modified Status 175
Other Controls 176
Problems 177
Chapter 9 — Graphics 178
The Ball Game Form 180
The Ball Class 188
The Ten High Scores Dialogs and Data 194
Double Buffering to Reduce Flicker 200
More GDI Details 201
Image Processing 202
Handling the Mouse 207
The Tool Strip 208
Problems 210
Chapter 10 — Database Operations 212
Relational Database Concepts 212
Beginning SQL Statements 215
The ADO.NET Object Model 217
Making a Table Viewer 219
Database Classes and Details 226
Handling Inserts, Deletes, and Updates 228
Making an Invoice Picker Program 230
Step 1 Getting the Combobox and the Text Boxes Working 231
Step 2 Getting the Items Purchased DataGridView Working 233
Problems 234
Chapter 11 — Database Updates 235
Coding the Add Update Dialog 237
Coding the Main Form for Pgm11aWindows 238
Problems 243
Chapter 12 — ASP.NET and Web Actions 244
Setting Up Visual Studio .NET 2008 For Web Projects 246
Setting Up Web Servers 247
Method 1 — Two Or More Computers with One Being the Server 247
Method 2 — Single Computer Using IIS 248
Method 3 — Using Visual Studio’s Web Server to Setup a Local Host to Any Web Folder on Your Computer 249
Method 4 — Letting Visual Studio .NET 2008 Automatically Run Your Web Site When You Choose Debug — Start Without Debugging 250
Making New Web Site Projects Using Visual Studio .NET 2008 250
Basic HTTP Logic 252
Some Additional Terminology 253
The HTML Document 254
Some Design Tips 262
Scripting 263
Client-side Scripting and Server-side Scripting 263
Web Forms and Page Processing 264
Programming Problems 270
Chapter 13 — Web Controls 271
Simulating Tables the Easy Way 274
Validation of Form Data 280
The Page_Load Function 284
Client-side Coding 285
Transferring Data Between Pages 290
Method 1 Using Server.Transfer 290
Method 2 Using PostBackUrl on a Submit Button 296
Additional Methods of Accessing the Previous Page’s Controls 299
Method A: Using an @PreviousPageType Directive 300
Method B: Typecast the PreviousPage into an OrderPage1 Class 300
Programming Problems 305
Chapter 14 — Web Sites and Databases 306
Programming Problems 312
Chapter 15 — Miscellaneous Topics 313
The System Registry 313
Attributes 316
Using Colors 320
Programming Problems 327
Chapter 16 — Dlls and Deployment Code — Assemblies 328
Making DLLs — Class Library 328
Assemblies 330
Assembly Manifest Contents 332
Deployment Methods 333
Private Assemblies 333
Making a Strong Name DLL 334
Making the Pgm16dClassLibClient with Strong Key Assembly 336
Dynamically Loading a Needed DLL at Run Time 336
The Global Assembly Cache 338
Deployment Methods Continued 339
How Windows Installer 2.0 Works with Assemblies 340
Setup For Pgm16aWindows (Pgm08aWindows revisited) 340