You are previewing Microsoft®C# Programming for the absolute beginner.
O'Reilly logo
Microsoft®C# Programming for the absolute beginner

Book Description

Using game creation as a teaching tool, this book not only teaches C#, it also teaches the fundamental programming concepts you need to grasp in order to learn any computer language. You will be able to take the skills learned in this book and then apply them to your own situation. Microsoft C# Programming for the Absolute Beginner is a unique book aimed at the novice programmer. Developed by computer science instructors, this series is the ideal tool for anyone with little to no programming experience.


  • A fun approach to a difficult topic -- create games in C# as you learn the fundamentals

  • A gentle introduction into the world of programming

  • The CD includes all of the code and games from the book

  • Provides a firm foundation in programming principles

Table of Contents

  1. Dedication
  2. Acknowledgements
  3. About the Author
  4. Introduction
  5. Basic Input and Output: A Mini Adventure
    1. Project: The Mini Adventure
    2. Reviewing Basic C# Concepts
    3. Saying “Hello, World!”
    4. Moving from Code to a Program
    5. Compiling Your Program
    6. Looking for Bugs
    7. Getting Input from the User
    8. Incorporating a Variable in Output
    9. Combining String Values
    10. Launching the Mini Adventure
    11. Summary
  6. Branching and Operators: The Math Game
    1. The Math Game
    2. Using Numeric Variables
    3. Converting Variables
    4. Creating a Branch in Program Logic
    5. Working with The Switch Statement
    6. Creating a Random Number
    7. Creating the Math Game
    8. Summary
  7. Loops and Strings: The Pig Latin Program
    1. Project: The Pig Latin Program
    2. Investigating The String Object
    3. Using a For Loop
    4. Varying the For Loop’s Behavior
    5. Using a While Loop
    6. Planning Your Program with the STAIR Process
    7. Applying STAIR to the Pig Latin Program
    8. Writing the Pig Latin Program
    9. Summary
  8. Objects and Encapsulation: The Critter Program
    1. Introducing the Critter Program
    2. Creating Methods to Reuse Code
    3. Creating a Menu
    4. Creating a New Object with the CritterName Program
    5. Adding a Method
    6. Creating the talk() Method for the CritterTalk Program
    7. Changing the Menu to Use the talk() Method
    8. Creating a Property in the CritterProp Program
    9. Making the Critter More Lifelike
    10. Summary
  9. Constructors, Inheritance, and Polymorphism: The Snowball Fight
    1. Introducing the Snowball Fight
    2. Inheritance and Encapsulation
    3. Creating a Constructor
    4. Overloading Constructors
    5. Using Inheritance to Make New Classes
    6. Improving an Existing Class
    7. Using Polymorphism to Alter a Class’s Behavior
    8. Creating the Snowball Fight
    9. Summary
  10. Creating a Windows Program: The Visual Critter
    1. Introducing the Visual Critter
    2. Creating a Windows-Style Program with a GUI
    3. Examining the Code of a Windows Program
    4. Creating an Interactive Program
    5. Allowing for Multiple Selections
    6. Working with Images and Scroll Bars
    7. Revisiting the Visual Critter
    8. Summary
  11. Timers and Animation: The Lunar Lander
    1. Introducing the Lunar Lander
    2. Reading Values from the Keyboard
    3. Animating Images
    4. Using a Timer to Automate Animation
    5. Adding Motion
    6. Detecting Collisions between Objects
    7. Bouncing the Ball off the Sides
    8. Checking for Collisions
    9. Extracting a Rectangle from a Component
    10. Getting More from the MessageBox Object
    11. Coding the Lunar Lander
    12. Summary
  12. Arrays: The Soccer Game
    1. The Soccer Game
    2. Introducing Arrays
    3. Working with Arrays
    4. Designing the Soccer Game
    5. Designing Programs by Hand
    6. Building the Soccer Program
    7. Setting Up the Players
    8. Setting Up the Opponents
    9. Setting Up the Goalies
    10. Responding to Player Clicks
    11. Handling Good Shots
    12. Handling Bad Shots
    13. Setting a New Current Player
    14. Handling the Passage of Time
    15. Updating the Score
    16. Summary
  13. File Handling: The Adventure Kit
    1. Introducing the Adventure Kit
    2. Reading and Writing Text Files
    3. Creating Menus
    4. Using Dialog Boxes to Enhance Your Programs
    5. Storing Entire Objects with Serialization
    6. Returning to the Adventure Kit Program
    7. Summary
  14. Chapter Basic XML: The Quiz Maker
    1. Introducing the Quiz Maker Game
    2. Investigating XML
    3. Reading an Existing XML Document
    4. Writing New Values to an XML Document
    5. Examining the Quizzer Program
    6. Summary
  15. Databases and ADO.NET: The Spy Database
    1. Introducing the SpyMaster Program
    2. Creating a Simple Database
    3. Using Queries to Modify Data Results
    4. Working with Relational Databases
    5. Working with Other Databases
    6. Creating the SpyMaster Database
    7. Summary