[Guest post] Learn C# with Visual Studio, Visual Studio for Mac, and Unity (and win a free book!)

Jon Galloway

This post was authored by guest blogger Andrew Stellman, author of the Head First C# book series, and published by the Visual Studio for Mac team on his behalf.

UPDATE: The book giveaway challenge is complete. We will be announcing winners on the Visual Studio blog within the next week. Thank you for your submissions!

Visual Studio is an amazing development tool. But Visual Studio and Visual Studio for Mac are more than just intuitive, state-of-the-art development environments. They’re also remarkably powerful learning and exploration tools, with features to help you create and understand your code. I love teaching and learning about C# with Visual Studio. That’s why my co-author, Jenny Greene, and I put Visual Studio and Visual Studio for Mac right at the center of our latest book, Head First C# (4th edition), published by O’Reilly Media. Head First C# incorporates Visual Studio directly in the learning. combining Visual Studio with the unique and innovative “brain-friendly” Head First approach to teaching helps us make learning C# easier and more fun for our readers.

The "Sleuth it out" elements throughout the book leverage Visual Studio's powerful debugging features to help you track down and fix bugs.

Visual Studio is built with modern development in mind, and we take advantage of that to teach you real-world programming techniques and practices. We teach important, practical skills throughout Head First C# that developers use every day, from refactoring to debugging to unit testing. For example, in many projects throughout the book, you’ll get practice with debugging techniques for tracking down, “sleuthing” out, and fixing bugs in your code—and you’ll use the powerful debugging features of Visual Studio to help you do it. And you’ll use Visual Studio’s powerful code generation tools throughout the book, whether you’re learning core C# building blocks like generating methods or focusing on more advanced concepts like lambda expressions.

Head First C# is packed with stories, puzzles, and exercises to keep you engaged and give you different ways to learn. The new edition features the visually rich, multisensory Head First format that’s based on the latest in cognitive science and learning theory that engages your mind and emotions. Most of all, you’ll get practice with lots of coding projects, complete with sample solutions. You can download the first four chapters of Head First C# for free from the book’s GitHub page.

Interested? Then keep reading, because we’re giving away copies of Head First C#. The contest ends December 9, 2020, so get started now!

Graphical user interface Description automatically generated

Why Head First C# is right for you

Head First C# is a unique, in-depth, and brain-friendly guide to help you learn all about writing code in C#. This is the fourth edition of the book, and we’ve spent over a decade talking to C# learners and finding innovative ways to help you learn C#. We’ve talked to many C# developers over the years, from fledgling programmers to senior engineers, as well as many amazing folks at Microsoft who work on C# and .NET every day. We’ve used those valuable lessons that we’ve learned to create a fun and effective learning experience for you.

We want you to learn C#. But more than that, we want to help you on your journey to becoming a better developer. That’s why Head First C# goes beyond teaching the language:

  • You’ll learn real-world techniques like refactoring and unit testing that professional developers use to create great code.
  • You’ll sleuth out bugs and get practice debugging code.
  • You’ll build lots of games—and you’ll use them to learn practical lessons that apply to all kinds of programming, not just game development.
  • You’ll write a lot of C# code—and have fun doing it!

A unique focus on Windows, Mac, and Unity

The world of C# and .NET has grown substantially over the last few years. While C# has always been part of the Windows world, it’s increasingly important for Mac development. That’s why all of the projects in Head First C# are based on .NET Core, Microsoft’s free and open-source framework for Windows, Linux, and macOS.

We worked especially hard to make your Mac a first-class citizen of Head First C#. Visual Studio for Mac is a powerful and innovative development environment, and we worked closely with the Visual Studio for Mac team to fully integrate it into Head First C#.

Visual Studio also provides a great gateway into game development. Building games is a great way to get practice C#, which is why Head First C# features a series of Unity Labs, in which you’ll reinforce the C# lessons you’ve learned by building 3D games. Whether you’re using Windows or macOS, Visual Studio integrates tightly with Unity, the powerful cross-platform game engine that you can use to create games for many different operating systems and consoles.

You’ll get practice with C# by building 3D games with Unity. This is part of the Unity Lab about Unity’s powerful AI navigation system.

Game design… and beyond

We included dozens of coding projects throughout Head First C#, and many of those projects are games. We didn’t do this simply because we love games. Games can be effective tools for learning and teaching C#. Here’s why:

  • Games are familiar. When you’re learning a new language, you’re immersed in a lot of new concepts and ideas. Giving you something familiar to grab onto can make the learning process go more smoothly.The “Game design... and beyond” elements use modern game design ideas to teach broader programming concepts that apply to any kind of app (not just games).
  • Games make it easier to explain projects. When you start one of the projects that we’ve designed for you, the first thing you need to do is understand what we’re asking you to build—and that can be surprisingly difficult. When we use games for our projects, that makes it easier for you to quickly figure out what we’re asking and dive right into the code.
  • Games are fun to write! Your brain is much more receptive to new information when you’re having fun, so including coding projects where you’ll build games is, well, a no-brainer (excuse the pun).

Hit the ground running by starting out with an engaging game project

You’ll build a fun animal matching game—and get oriented with Visual Studio—in the very first chapter.

When you use Head First C# to learn C#, you’ll dive right in from the very beginning. In the first chapter of the book, you’ll start writing C# code—and get oriented with Visual Studio—by building an animal matching game.

.NET Core console apps are great if you need to input and output text. If you want a visual app that’s displayed on a browser page, you’ll need to use a different technology—and that’s why we included two different versions of this game. There’s a Windows-exclusive version that uses WPF (Windows Presentation Framework), a technology that you’ll use to build Windows desktop apps. But we don’t want macOS readers to miss out on the fun! That’s why we included a Visual Studio for Mac Learner’s Guide that includes an ASP.NET Blazor version of every WPF project in the book, including a complete replacement for the animal match game in Chapter 1.

With Blazor, you can create rich web applications that can run in any modern browser. The goal of the Blazor animal match game project is to introduce you to Blazor, and to give you tools to build rich web applications as well as console apps. By the time you’re done with the project, you’ll be a lot more familiar with the tools that you’ll rely on throughout the book to learn and explore C#.

The first chapter of Head First C# walks you through creating the game just like you would with a professional development project: by building it in a series of parts that lead towards a final goal of a playable, fun game. Here’s what you’ll do:

  1. Create a new Blazor WebAssembly App project in Visual Studio.
  2. Lay out the page and write C# code to shuffle the animals.
  3. The game lets the user click on pairs of emoji to match them.
  4. Write more C# code to detect when the player has won the game.
  5. Make the game more exciting by adding a timer.

Diagram Description automatically generated

The Contest – win a free copy of Head First C#

Are you excited yet? We’ve teamed up with the Visual Studio team to give away free copies of Head First C#. Here’s how:

  1. Download the free PDF of the first four chapters of Head First C# from the book’s GitHub page.
  2. Do the animal match game Chapter 1 using Blazor, WPF, or Unity.
  3. Fill out this form to enter the giveaway by 11:59 p.m. PT,  December 9, 2020.
  4. We’ll randomly select the winners and announce them on the Visual Studio blog.

The official contest rules are available for download in PDF format. Doing a project or puzzle from the book is not required for entry, and if you prefer to submit code from another lab from the book, that’s okay, too. But if you do a project, we encourage you to get creative and put your own, unique spin on it! Upload your code to GitHub and paste in a link to it when you submit your entry. After we select randomly choose the contest winners, we’ll pick some of our favorite projects and highlight them in the follow-up blog post where we announce the winners. This could be your chance for fame and fortune!

15 comments

Discussion is closed. Login to edit/delete existing comments.

  • Mystery Man 0

    The big blue download button is broken. (Fortunately, there are other download links in this article.)

    And my God! This book is a hot mess! Is it really a book or a giant meme? There are even racial and political jokes in it, meant strictly for the American audience.

    • Jon GallowayMicrosoft employee 0

      Thanks for reporting the problem with the blue button link, it’s fixed now.

    • Robert Woods 0

      I love the style. I guess you can’t please everyone.

    • Jeffrey Counts 0

      There definitely aren’t racial or political jokes in it – maybe you misread something? Also the style was launched in 2003 with Head First Java, and has produced award winning books. The style might not be for everyone, but it is, in fact, supported by psychological research into how the brain learns best (see page 3 of the Intro chapter of the download if you’re curious). For people like me, however, the series has been life altering. Head First Java is what inspired me to pursue a career in software engineering. And when I switched to C#, I went straight to Head First. This fourth edition, in my opinion, is the best programming book I have ever read.

  • Paul Lucas 0

    Great and helpful for a programmer coming back after 15 years and wanting to start with a new language. helping my old brain learn which is no small feat!

  • Rbs land 0

    Its really a interesting article about guest post learn C. I really recommend this great work to Royal Business Solutions to write information about this style.

  • LIU TONY 0

    Hello Jon .. I am Liu
    I just a beginner coder. thanks for your inspiring post

  • Matthew Strong 0

    I am really loving this book so far and learning so much. I love the approach and questions I have had for years are finally answered. A simplistic teaching approach in programing is a good thing, different than anything else out that! It’s practical and interesting.

  • Fernando Nogueira 0

    Shouldn’t the contest form close only in a few hours? I was trying to submit my form and I get “This giveaway is now completed. Watch the Visual Studio blog for winners to be announced!” and I believe that this might be wrong and that we are not yet after 11:59 p.m. PT, December 9, 2020.

    • Jon GallowayMicrosoft employee 0

      Sorry! The form was accidentally closed at 11:59 a.m. PT instead of p.m.. I’ve re-opened the form, please submit your entry!

      • Fernando Nogueira 0

        Hi Jon, thank you for re-opening, but I was a sleep when you replied so I didn’t had the chance to resubmit, so here my details:

        1. Github repo: https://github.com/fjsnogueira/matchgame
        2. Name: Fernando Nogueira
        3. Email: fjsnogueira@gmail.com

        Thank you for your post.

  • Larry Griffin 0

    Why is Unity Hub suggested rather than installing Unity with the Visual Studio Installer?
    I tried to sign up for a Unity account but never got the confirmation email so can’t go any further. 🙁
    I’ll try installing Unity from VS Installer and see how that goes.

  • Tarun Pant 0

    Hey Jon, Thank you for the exciting post, I am excited for the draw. When is it going to happen?

  • Shef Sam 0

    I missed the contest. Will you be running it again?

  • Carmelo Aldo 0

    It’s actually a fascinating article about visitor post learn C. I truly prescribe this extraordinary work to Royal Business Solutions to compose data about this style.

Feedback usabilla icon