Part I - Programming Basics on the Console

Chapter 1 The Mini Adventure

cs01.zip Basic C# Concepts Namespaces Classes Methods Commands Examining the Console Object Looking at the .NET Documentation The System Namespace The Console Class The Write() Method The WriteLine() Method Generalizing From this Experience Writing the Hello World Program Getting into the Visual Studio .NET environment Starting a New Project Choosing the Project Type Examining the Code Window Examining the Default Code Using the System Namespace Creating a Custom Namespace The Summary Comments Creating the Class The Main Method The Rest of the Code Writing to the Console Placing Semicolons Correctly Moving From Code to a Program Compiling your Program Looking for Bugs Getting Input from the User Creating a String Variable The Console.ReadLine() Method Incorporating a Variable in Output Combining String Values Concatenation Adding a Tab Character Using the Newline Sequence Displaying a Backslash Displaying Quote Symbols The Mini Adventure Planning the Story Creating the Variables Getting Values from the User Writing Output Finishing up the Program Challenges Summary

Chapter 2 - Numeric Variables

cs02.zip The Math Game Numeric Variables The Simple Math Game Numeric Variable Types Integer Variables Long Integers Floating Point Variables Data Type Problems Math Operators Converting Variables Explicit Casting Using the Convert Object Creating a Branch in Program Logic The Hi Bill Game Testing a Condition The If Statement The Else Clause Checking Multiple Conditions Using the Switch Statement The Switch Demo Program How Switch Works Creating a Random Number The Die Roller The Random Object Creating a Random Number with the NextDouble() Method Getting the Values of Dice Creating the Math Game Design of the Game Creating the Variables The Addition Problem Managing Subtraction Multiplication and Division Checking the Answers Waiting for the Carriage Return Challenges Summary

Chapter 3 - Loops and Strings

cs03.zip The Pig Latin Machine The String Object The String Mangler Program Looking more Closely at Strings Using the Object Browser Experimenting with String Methods Some Common String Manipulations Using a For Loop The Bean Counter Program Creating a Sentry Variable Checking for an Upper Limit Incrementing the Variable Examining the Behavior of the For Loop Variations of the For Loop The Fancy Beans Program Skipping Numbers Counting Backwards Using a Foreach loop to Break up a sentence Creating a While Loop The Magic Word Program Creating an Effective While Loop Creating and Initializing a Sentry Variable Designing an Appropriate Condition Changing the Variable Inside the Loop Writing Effective While Loops Learning How to Plan your program The STAIR process S - State the Problem T - Tool Identification A - Algorithm I - Implementation R - Refinement Applying STAIR to the Pig Latin Program Statement of the Problem Tool Identification Algorithm Implementation and Refinement Writing the Pig Latin Program Setting up the variables Creating the Outside Loop Breaking the Phrase into Words Extracting the First Character Checking for a Vowel Adding Debugging Code Closing Everything up Summary Challenges

Chapter 4 - Objects and Encapsulation

cs04.zip The Critter Program Creating Methods to Reuse Code The Song Program Looking at the Main Method Creating a Simple Method Adding a Parameter Returning a Value Creating a Menu Creating a Main Loop The Sentry Variable Calling a Method Working With the Results The ShowMenu() Method Getting Input from the User Handling Exceptions Returning a Value Creating a New Object The Basic Critter Using Scope Modifiers Using a Public Instance Variable Creating an Instance of the Critter Referring to the Critter's Members Adding a Method Creating the Talk() Method Changing the Menu to use the Talk() Method Creating a Property Examining the CritterProp Program The Critter with a Name Property Making a Private Instance Variable The Basic design of a Property Creating a Get method Creating a Set Method Using Properties as Filters Making the Critter More LifeLike Adding More Private Variables Teaching the Critter how toAge Adding the Feed() Method Creating the Play() Method Modifying the Talk() Method Changes in the Main Class Summary Challenges

Chapter 5 - Constructors, Inheritance, and Polymorphism

cs05.zip The Snowball Fight Introducing the Snowball Fight Inheritance and Encapsulation Creating a Constructor Adding a Constructor to the Critter Class The CritterView Class Reviewing the Static Keyword Calling a Constructor from the Main() Method Examining the Constructor of CritViewer Working with Multiple Files OverLoading Constructors Viewing the Improved Critter Class Adding Polymorphism to your Objects Modifying the CritterViewer to Demonstrate Overloaded Constructors Using Inheritance to Make New Classes Creating a Class to view the Clone Creating the Critter Class Improving on Existing Classes Introducing the GlitterCritter Calling the Base Class's Constructors Adding Methods to an Inherited Class Changing the Critter Viewer Again Using Polymorphism to Alter a Class's Behavior The BitterCritter Building the Fighter Setting up the Basic Fighter Writing the Fighter Constructor Throwing a Snowball Building the Robot Fighter Initializing the RoboFighter Choosing the Robot's Play Creating the Main() Method Setting up the Main Menu Writing the Menu's Constructor Managing the User's Responses Checking for a Winner Displaying the Menu Summary Challenges

Part II - Programming in Windows

Chapter 6 - Creating a Windows Program

cs06.zip The Visual Critter Introducing the Visual Critter Creating a Windows-style Program Thinking like a GUI Programmer Objects are Everywhere The user is in Control Programs Respond to Events Problems are Solved Differently Events are Added to the Object Model Creating a Graphic User Interface Creating a Windows Project Looking at the Form Builder Changing the Properties of the form Adding a Label to the Form Changing the Label's Properties Running the Program Examining the Code of a Windows Program Adding New Namespaces The System.Windows.Forms namespace Using Inheritance to Relate Components The System.Drawing Namespace The Other Namespaces Creating the Form Object Creating a Destructor Creating the Components Setting Component Properties Setting up the Form Writing the Main() Method Creating an Interactive Program Responding to a Simple Event Creating and Adding the Components Adding an Event to the Program Creating an Event Handler Allowing for Multiple Selection Choosing a Font with Selection Controls Creating the User Interface Examining Some Selection Tools The List Box Radio Buttons Check Boxes Other Selection Tools Custom Variables in The Font Chooser Writing the assignFont() Method Getting the Font Name from the List Box Getting the Style from the Check Boxes Looking for the Font Size Code Writing the Event Handlers Working with Images and Scroll Bars Changing an Image's Size Setting up the Picture Box Adding an Image to the Picture Box Manipulating the Image's SizeMode Property Adding a Scroll Bar Writing the Event-Handling Code Returning to the Visual Critter The Program Design Determining the Tools Needed Designing the Form Writing the Code Adding Instance Variables Responding to a Change in the Combo Box Clicking on the Critter Changing the Critter's Name Changing the Critter's Color Changing the Critter's Size Summary Challenges

Chapter 7 - Timers and Animation: The Lunar Lander

cs07.zip Introduction The Lander Program User controls a Lunar Lander Attempts safe landings The Picture Object The ShowImages Program Creating a Picture Component Displaying the Picture Changing the Picture The Timer Object The Car Program Incorporating a Timer Object Setting the Timer's interval The Timer event Moving the Car Checking the Boundaries Writing the Lunar Lander Program Design Accounting for Gravity Adding the thrusters Leaving the Screen Checking for a landing Challenges Summary

Chapter 8 - Arrays: The Forest Fire

cs08.zip Introduction The Forest Fire Program Game Simulates a Forest Fire Player can set fires, drop retardant, dig breaks Goal is to put out fire quickly Introducing Arrays The Counter Program Creating an array of strings Referring to elements in an array The Image List Control The animator Storing a series of images Playing them Back under timer control Other Listing Controls The Chooser Program The List Box The Combo Box Radio Buttons CheckBoxes Two Dimensional Arrays The Grid Control A Two - Dimension array in memory Storing and retrieving information in a two-dimensional array The Forest Fire Program Creating the Acre Object The Forest array of Acres Checking neighbors Getting player input Challenges Summary

Chapter 9 - File Handling: The Cartoonifier

cs09.zip Introduction The Cartoonifier Reads a file Converts it to a cartoon-like form Saves the file in it's new form The IO Library The data stream architecture Sequential access files Writing to a File The file writer program The File Object The StreamWriter Class Writing to a stream Reading from a file The file reader program The File Dialog Object The StreamReader Class Reading from a stream Making a Text Editor The Text editor program Multiple streams Dealing with exceptions Basic Regular Expressions The Regex Class The basic components Metacharacters Repeat Commands Replacing segments Building the Cartoonifier Reading the file Building the regular expressions Applying the expressions Saving the file Challenges Summary

Part III - Special Features of C#

Chapter 10 - Basic Data Handling: the Adventure

cs010.zip Introduction The Simple Adventure Game Presents a series of challenges Each includes a description, choice, and graphic User makes a choice Presented with a new challenge Includes an editor to build new adventures! Database Basics The spy database Using a DBMS Tables, records, and fields Creating a flat - file database Generating simple queries Incorporating a Database Into a Program The spy program The ADO.Net Namespace Connecting to a data source Querying a data table Generating the Adventure Game Designing the Program Building the database Creating the editor Creating the playing engine Challenges Summary

Chapter 11 - Basic XML: Simple SMIL

cs11.zip Introduction The Slide Editor User generates a slide show in text editor Slide show uses an XML syntax Program displays the slide show Program translates the slide show into HTML XML essentials The SMIL language Basic SMIL tags An example of a SMIL file Creating a Schema Determining Elements Generating attributes The syntax of a xsd schema Creating a Document Importing a schema Using the schema Working with an XML file Importing the schema Responding to the various tags Creating the Slide editor Determining the SMIL subset Developing the schema Implementing the schema Working with time Challenges Summary

Chapter 12 - Web Services: The Joke Machine

cs12.zip Introduction The Joke Machine User Connects to web page User must submit a joke User is given another joke Setting up for Web Services System Requirements Working on a server Using a thin client (browser) Creating a Web Form Differences between windows and Web forms Web Controls Deploying a Web Service Testing on a local installation Deployment on a server Challenges Summary