Head First C#

Head First C#

Available now!

Head First C# is a complete learning experience for object-oriented programming, C#, and the Visual Studio IDE. Built for your brain, this book covers C# 3.0 and Visual Studio 2008, and teaches everything from language fundamentals to advanced topics including garbage collection, extension methods, and double-buffered animation. You'll also master C#'s hottest and newest syntax, LINQ, for querying SQL databases, .NET collections, and XML documents. By the time you're through, you'll be a proficient C# programmer, designing and coding large-scale applications.

Every few chapters you will come across a lab that lets you apply what you've learned up to that point. Each lab is designed to simulate a professional programming task, increasing in complexity until-at last-you build a working Invaders game, complete with shooting ships, aliens descending while firing, and an animated death sequence for unlucky starfighters. This remarkably engaging book will have you going from zero to 60 with C# in no time flat.

A collection of images from inside the book.

What you need for this book

We wrote this book using Visual C# 2008 Express Edition, which uses C# 3.0 and .NET Framework 3.5. All of the screenshots that you see throughout the book were taken from that edition, so we recommend that you use it. If you're using Visual Studio 2008 Standard, Professional, or Team System editions, you'll see some small differences, which we've pointed out wherever possible. You can download the Express Edition for free from Microsoft's website—it installs cleanly alongside other editions, as well as previous versions of Visual Studio.

Click here for an explanation of Setting up Visual Studio 2008 Express Edition.

Code Viewing and Downloads

Download all the code in the book (zip)

View and download the code by chapter:
  • (There is no code for Chapter 1)
  • Chapter 2, Flashy Thing and Fun with If Else
  • Chapter 3, Joe and Bob
  • Chapter 4, Mileage Calculator, Sloppy Joe, and Swapping Elephants
  • Chapter 5, Cow Calculator and Dinner Party
  • Chapter 6, Bee Management System and Birthday Party
  • Chapter 7, Explore the House, Fingers the Clown, Hide and Seek, and TallGuy
  • Chapter 8, Breakfast for Lumberjacks, Card Comparer, Cards, Go Fish, and Two Decks
  • Chapter 9, Excuse Manager and Simple Text Editor
  • Chapter 10, Beehive Simulator and Excuse Manager
  • Chapter 11, Baseball, Secret Ingredients, and Whack-a-mole
  • Chapter 12, Beehive Simulator
  • Chapter 13, Beehive Simulator and Zoomer
  • Chapter 14, Clones
  • Chapter 15, Jimmy's Comics and Objectville Promotion

Get the graphics files (all zip downloads):

Check out the labs:

We made you write the code, and you sent us some great ones! Congratulations to everyone who participated. You can still send in creative alternatives, though—see these details.

Advance Reviews

"I've never read a computer book cover to cover, but this one held my interest from the first page to the last. If you want to learn C# in depth and have fun doing it, this is THE book for you."
—Andy Parker, fledgling C# programmer

"Head First C# is a great book for hobbyist programmers. It provides examples and guidance on a majority of the things [those] programmers are likely to encounter writing applications in C#."
—Peter Ritchie, Microsoft MVP (2006-2007), Visual Developer, C#

"With Head First C#, Andrew and Jenny have presented an excellent tutorial on learning C#. It is very approachable while covering a great amount of detail in a unique style. If you've been turned off by more conventional books on C#, you'll love this one."
—Jay Hilyard, Software Developer, co-author of C# 3.0 Cookbook

"Head First C# is perfect blend of unique and interesting ways covering most of the concepts of programming. Fun excercises, bullet points, and even comic strips are some of the catchy and awesome works that this book has. The game-based labs are something that you really don't want to miss. [This book is] a great work... the novice as [well as the] well-experienced will love this book. GREAT JOB!"
—Aayam Singh, .NET professional

"Head First C# is a highly enjoyable tutorial, full of memorable examples and entertaining exercises. Its lively style is sure to captivate readers—from the humorously annotated examples, to the Fireside Chats, where the abstract class and interface butt heads in a heated argument! For anyone new to programming, there's no better way to dive in."
—Joseph Albahari, C# Design Architect at Egton Medical Information Systems, the UK's largest primary healthcare software supplier, co-author of C# 3.0 in a Nutshell

"[Head First C#] was an easy book to read and understand. I will recommend this book to any developer wanting to jump into the C# waters. I will recommend it to the advanced developer that wants to understand better what is happening with their code. [I will recommend it to developers who] want to find a better way to explain how C# works to their less-seasoned developer friends."
—Giuseppe Turitto, C# and ASP.NET developer for Cornwall Consulting Group

"Andrew and Jenny have crafted another stimulating Head First learning experience. Grab a pencil, a computer, and enjoy the ride as you engage your left brain, right brain, and funny bone."
—Bill Mietelski, Software Engineer

"Going through this Head First C# book was a great experience. I have not come across a book series which actually teaches you so well…This is a book I would definitely recommend to people wanting to learn C#"
—Krishna Pala, MCP
Order
Direct from O'Reilly
(opens a new window)

Buy 2 books, get 1 free!

Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.

Who is this book for?

If you can answer "yes" to all of these:

  • Do you want to learn C#?

  • Do you like to tinker—do you learn by doing, rather than just reading?
  • Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?

You should probably back away from this book if you can answer "yes" to any of these:

  • Does the idea of writing a lot of code make you bored and a little twitchy?
  • Are you a kick-butt C++ or Java programmer looking for a reference book?
  • Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if C# concepts are anthropomorphized?

Forum

Ask the authors questions and chat with fellow readers in the Head First C# Forum.

Also by Andrew Stellman & Jennifer Greene

Head First PMP

Head First PMP offers 100% coverage of The PMBOK® Guide principles and certification objectives in a way that's engaging, not tedious. This book helps you prepare for the PMP certification exam with a unique method that goes beyond answers to specific questions and makes you think about the big picture of project management.