Skip to main content


Beginning C# 3.0: An Introduction to Object Oriented Programming

Jack Purdum

ISBN: 978-1-118-05961-6 January 2011 552 Pages


Learn all the basics of C# 3.0 from Beginning C# 3.0: An Introduction to Object Oriented Programming, a book that presents introductory information in an intuitive format. If you have no prior programming experience but want a thorough, easy-to-understand introduction to C# and Object Oriented Programming, this book is an ideal guide. Using the tutorials and hands-on coding examples, you can discover tried and true tricks of the trade, understand design concepts, employ debugging aids, and design and write C# programs that are functional and that embody safe programming practices.


Part I: Getting Started.

Chapter 1: Getting Started.

Chapter 2: Understanding Objects.

Part II: Understanding C# Syntax.

Chapter 3: Understanding Data Types.

Chapter 4: Understanding C# Statements.

Chapter 5: Understanding Reference Data Types.

Chapter 6: Making Decisions in Code.

Chapter 7: Statement Repetition Using Loops.

Chapter 8: Arrays.

Part III: Writing Your Own Classes.

Chapter 9: Designing Classes.

Chapter 10: Designing and Writing Custom Classes.

Chapter 11: Exception Handling and Debugging.

Chapter 12: Generics.

Part IV: Storing Data.

Chapter 13: Using Disk Data Files.

Chapter 14: Using Databases.

Chapter 15: Inheritance and Polymorphism.

Appendix A: Exercise Solutions.


Chapter Code Downloads
There is no code for Chapters 1 and 4.
Code for listing 5-2
ChapterPageDetailsDatePrint Run
238Error in Text
The paragraph under Figure 2-10 instructs the reader to click the

OK button

But it should be

Add button

43Error in Table
In the table on page 43, it should be txtDisplayOutput instead of txtResult.

The code is correct as is the narrative. Only the table is wrong.

44Error in Code
" City: " + txtAddress.Text +

should be:
" City: " + txtCity.Text +


Mail Label program needs to include the ' this.Close' click event --

Author replies: Because the code for the Exit button is the same for every program in the book, and is only one statement (i.g., Close()), it isn't printed in the book. However, it is in the download code for the program.

65Error in Code
"as larget as e<sup>38</sup>"

should be:

"as larget as 10<sup>38</sup>"

116Typo in Text

Should be


120Error in Text
In the last paragraph before the "Replacing a Substring" section on the page:

its Text property to the new string

Should be

the new string to its Text property

138Typo in Text
Near the end of the largest paragraph on the page:


Should be


144Error in Code
In the code after the "Nested If Statements" heading, the code says

Price = FULLPRICE; If (age => 21)

But it should say ">=" not "=>"

"case 1" repeated should be case 1, case 2, case 3,....

151Error in Code
The code at the top of the page should contain several cases for the switch statement. Your code has a switch statement with three ?case 1?s.

252Typo in Code Comment
The comment in the code:

// Is this card place in the deck is "unused"?

Should be:

// Is this card place in the deck "unused"?

301Error in Code
second line of code from the bottom says:

mySort.quickSort(data.Length-1); // Sort the data

The function quickSort takes two parameters and it should be

mySort.quickSort(0, data.Length-1); // Sort the data

467Error in Code
If (answer == 0)

Should be:

if (answer == 0)

469Error in Code
Page 469 requires the following 2 lines for the code to serve its purpose:

if (birthday.DayOfYear > currentDate.DayOfYear)

age -= 1;

472Error in Code
const int FOURPOUNDS = 48;

should be

const int FOURPOUNDS = 64;

because there are 16 ounces in a pound, not 12

8474Error in Code
The code on page 474 generates inaccurate numbers. The code should read:

start--; // This is the new line

female = 3.5 * start - 108

male = 4.0 * start - 128


Typo in Source Code
In the readme.txt file in the zip archive, from chapter 5 and below:


Should be