A Learner's Guide to Real-World Programming with C# and .NET Core
Andrew Stellman, Jennifer Greene

#Csharp
#.NET
#3D_games
#Unity
#LINQ
#Visual_Studio
#data
#Head_First
What will you learn from this book?
Create apps, games, and more using this engaging, highly visual introduction to C#, .NET, and Visual Studio. In the first chapter you'll dive right in, building a fully functional game using C# and .NET MAUI that can run on Windows, Mac, and even Android and iOS devices. You'll learn how to use classes and object-oriented programming, create 3D games in Unity, and query data with LINQ. And you'll do it all by solving puzzles, doing hands-on exercises, and building real-world applications. Interested in a development career? You'll learn important development techniques and ideas—many who learned to code with this book are now professional developers, team leads, coding streamers, and more. There's no experience required except the desire to learn. And this is the best place to start.
What's so special about this book?
If you've read a Head First book, you know what to expect: a visually rich format designed for the way your brain works. If you haven't, you're in for a treat. With this book, you'll learn C# through a multisensory experience that engages your mind—rather than a text-heavy approach that puts you to sleep.
Table of Contents
1 Start building apps with C#: Build something great...fast!
2 Variables, statements, and methods: Dive into C# code
Unity Lab 1: Explore C# with Unity
3 Namespaces and classes: Organizing your code
4 Data, types, objects, and references: Managing your app’s data
Unity Lab 2: Write C# Code for Unity
5 Encapsulation: How objects keep their secrets
6 Inheritance: Your object’s family tree
Unity Lab 3: GameObject Instances
7 Interfaces, casting, and is: Making classes keep their promises
8 Enums and collections: Organizing your data
Unity Lab 4: User Interfaces
9 LINQ and lambdas: Get control of your data
10 Reading and writing files: Save the last byte for me
Unity Lab 5: Raycasting
11 Captain Amazing: The Death of the Object
12 Exception handling: Putting out fires gets old
Unity Lab 6: Scene Navigation
This is a serious book to help you learn C#... but we worked hard to make it feel light and engaging and keep things interesting. This is the fourth edition of Head First C#, and with each consecutive edition, we’ve talked to readers and C# learners to figure out what works and what doesn’t, refining our techniques and the way we approach each new topic. We do all of that with two goals in mind: first, to get C# and real-world programming concepts into your brain efficiently; second, to make it as fun and interesting as possible.
Behind the fun is serious learning theory: we started with the latest research in cognitive science, neurobiology, and educational psychology, and combined it with over 15 years of real-world work with people just like you looking to learn C#. We anticipate the questions you have and answer them immediately, because flipping back and forth to find answers takes away from the fun. We designed puzzles and activities to keep you engaged, and included lots of relevant graphics, visual explanations, and stories to give your brain a break from the text. Every page of the book is carefully designed to be friendly, inviting, and engaging.
Head First C# uses images, stories, characters, and even comics to help your brain learn C# in different ways
Thorough coverage of C# techniques and concepts
The main goal of this book is to help you learn to write code and build projects with C#. C# is a simple, modern language that lets you do incredible things. When you learn C#, you’re learning more than just a language. C# unlocks the whole world of .NET Core, an incredibly powerful open-source platform for building all sorts of applications. You’ll learn core concepts like methods, classes, instances, references, object-oriented design, file management, and exception handling. You’ll use collections and LINQ (Language-Integrated Query) to manage data. You’ll even dive into modern C# features, like lambda expressions.
Head First C# takes full advantage of Visual Studio, Microsoft’s integrated development with highly intuitive features that make coding as easy as possible. Not only is Visual Studio a great tool for writing code, it’s also a really valuable learning tool for exploring C#. You’ll use Visual Studio to learn and explore important C# concepts like methods, interfaces, and references, and you’ll use its debugger to sleuth out and fix problems in your code.
Head First C# uses real-world concepts to help explain how your C# works
Building different kinds of projects is an important tool in your C# learning toolbox, and we chose the technologies for those projects carefully to give you the most effective learning experience possible. Many of the projects in the book are .NET Core Console Apps. In addition, most chapters feature WPF (Windows Presentation Foundation) projects to help you in this book because it gives you tools to design highly detailed user interfaces that run on many different versions of Windows (even very old editions, like Windows XP!).
C# isn’t just for Windows! Are you a Mac user? Well, then you’re in luck! We added a learning path just for you, featuring Visual Studio for Mac. See the Visual Studio for Mac Learner’s Guide.
You’ll dive into the code, and really understand how it works
Get practice with real-world programming skills
We want you to be a great developer! That’s why the book is focused on making it fun and easy to learn the C# programming language and how to do cross-platform development with .NET Core. But if you want to make a real leap as a programmer—especially if you’re looking to land a developer job—you’ll also need real-world skills that help you tackle larger projects and produce clean, high-quality code. That’s why Head First C# also includes lots of practice with real-world programming skills, including debugging code, creating paper prototypes, refactoring, unit testing, test-driven development, and incremental development. As you progress through the book, you’ll use these skills to take on bigger and bigger projects. By the time you’re done, you’ll have picked up a set of useful (and marketable!) development skills that you can use in the real world.
Game design… and beyond
You’re going to be writing code for lots of projects throughout this book, and many of those projects are games. We didn’t do this just because we love games.
Games can be effective tools for learning and teaching C#—and in Head First C# we use them to help you learn (even if you aren't planning on doing game development). Here’s why games work as effective learning tools:
Most importantly, in Head First C# we use games throughout this book to help you learn broader C# and programming concepts. Game design principles are an effective way to learn and explore
important programming concepts and ideas that apply to any kind of project, not just video games.
Use 3D game development with Unity to reinforce your C# skills
Unity is a cross-platform game development tool that you can use to make professional-quality games, simulations, and more. It’s also a fun and satisfying way to get practice with the C# tools and ideas you’ll learn throughout this book. That’s why we included a series of optional Unity Labs in Head First C#. Each Unity Lab is a short, targeted project to reinforce the concepts and techniques you learned earlier in the book to help you hone your C# skills. You’ll learn core Unity concepts and tools: creating 3D shapes and materials and use cameras, navigating scenes in the Unity editor, writing and debugging C# code for your Unity games, building user interfaces into your Unity projects, even working with Unity’s advanced physics and AI-assisted pathfinding and navigation system—and throughout all of those labs, you’ll get practice with the C# concepts you learn throughout the book.
Write code from the very start
One of the most effective ways to learn C# is to write lots of code, so in Head First C#, you’ll learn by doing. we give you a lot of practice writing code, starting with an animal matching game in the first chapter. As you progress through the book, you’ll write code to build games and apps, solving problems that help you learn important C# concepts. We worked hard to make each of these projects unique, interesting, and fun. Every project has a solution—we’ve given you the tools to solve every problem in the book, and the freedom and flexibility to get creative on your own.
What will you learn from this book?
Dive into C# and create apps, user interfaces, games, and more using this fun and highly visual introduction to C#, .NET Core, and Visual Studio. With this completely updated guide, which covers C# 8.0 and Visual Studio 2019, beginning programmers like you will build a fully functional game in the opening chapter. Then you'll learn how to use classes and object-oriented programming, create 3D games in Unity, and query data with LINQ. And you'll do it all by solving puzzles, doing hands-on exercises, and building real-world applications. By the time you're done, you'll be a solid C# programmer--and you'll have a great time along the way!
What's so special about this book?
Based on the latest research in cognitive science and learning theory, Head First C# uses a visually rich format to engage your mind rather than a text-heavy approach that puts you to sleep. Why waste your time struggling with new concepts? This multisensory learning experience is designed for the way your brain really works.
"Thank you so much! Your books have helped me to launch my career."
Ryan White, Game Developer
"If you're a new C# developer (welcome to the party!), I highly recommend Head First C#. Andrew and Jennifer have written a concise, authoritative, and most of all, fun introduction to C# development. I wish I'd had this book when I was first learning C#!"
Jon Galloway, Senior Program Manager on the .NET Community Team, Microsoft
"Not only does Head First C# cover all the nuances it took me a long time to understand, it has that Head First magic going on where it is just a super fun read."
Jeff Counts, Senior C# Developer
"Head First C# is a great book with fun examples that keep learning interesting."
Lindsey Bieda, Lead Software Engineer.
Andrew Stellman is a developer, architect, speaker, agile coach, project manager, and expert in building better software. Andrew is an author and international speaker, with top-selling books in software development and project management, and world-recognized expert in transforming and improving software organizations, teams, and code. He has architected and built large-scale software systems, managed large international software teams, and consulted for companies, schools, and corporations, including Microsoft, the National Bureau of Economic Research, Bank of America, Notre Dame, and MIT. He's had the privilege of working with some pretty amazing programmers during that time, and likes to think that he's learned a few things from them.
Jennifer Greene is an agile coach, development manager, business analyst, project manager, tester, speaker, and authority on software engineering practices and principles. She's been building software for over twenty years in many different domains including media, finance, and IT consulting. She's worked with teams of excellent developers and testers to tackle tough technical problems and focused her career on finding and fixing the habitual process issues that crop up along the way.









