tutorial

Teach yourself to code with C# and .NET
2014, April 30

UPDATE: There's a new version of this article with more up-to-date resources. Have a look here.

I have already written two different paths to learn web development from scratch: one using the Python language and one using Ruby. This is a 3rd option to seriously learn how to code and not to hack bits and pieces together, notice the difference. It has a focus on the C# language (pronounced "see sharp") and the Microsoft .NET Framework.

There's no TL;DR

You know the TL;DR (too long, didn't read) section you find on many blog posts and articles? Well, there's no such section if you are serious about learning how to code. You will eat lots and lots of pages if you follow the complete path below. 10'319 pages, to be precise. I counted. At an average speed of 50 pages per day, that's 207 days.

Although some outlets would like to make you believe that coding is easy and that you can become a rock star coder in a few weeks/months after building 3-4 demo projects, there are no short and easy way to be a developer. Keep in mind this is a profession and usually, developers take a long time to learn it and become proficient. Many even go a few years to school to learn the trade. I don't want to discourage you, with enough passion, time and motivation, it is something you can learn on your own. Many did and I am one of them.

Why choose C# and Microsoft .NET

C# is a modern, mature and popular language used to create many things, from web applications to games, Windows applications and services. It is backed by the .NET Framework, a huge toolbox of commonly used parts needed to build professional software. It consistently scores in the top position of the TIOBE Programming Community index, measuring languages popularity.

Due to its versatility and popularity, a lot of job opportunities in software development revolve around C#. Because it is often the technology of choice in large corporations doesn't mean it is not suited to build your next Facebook-killer app. Many startups have made the choice to go down the C# and .NET route.

A gentle introduction

To give you a little bit more context as to what programming is, read the section "What is a programming language" from my previous How to seriously teach yourself web development post. Done? Ok, let's start with a gentle introduction to programming with Python for Kids: A Playful Introduction to Programming (346 pages). Yes, you read that right: it is a book about Python and the title contains "for kids". Don't be put off by the title, it is actually a fantastic introduction to programming for both kids and adults alike. It doesn't use the C# language but Python to introduce some programming concepts you will use throughout your software development career.

Into C#

Armed with a better understanding of what programming is, you can dive into an introduction to the C# language with Head First C# (960 pages). As of this writing, the latest edition of the book makes use of Visual Studio 2012. Visual Studio 2013 has been released for a while but most examples will work with both versions. Or you can install Visual Studio 2012 to follow the examples exactly as they are presented to you in the book (there are free versions of Visual Studio, the Express editions).

Objects, you need them

C# is an object-oriented language. You picked that up from the previous book. If you still have some issues wrapping your head around the concepts, you can read the short OOP Demystified (288 pages). You will really need to master these concepts to become a good C# developer.

More C#

Now is time to leave the introductions and read something more technical. Professional C# 5.0 and .NET 4.5.1 (1498 pages) is the book you are looking for. It will give you a deeper understanding of the C# language as well as how it interacts with the latest version of the .NET Framework. Sections of the book are dedicated to various types of programs you can build using C# such as Windows applications and Web applications.

Time for a break, learn SQL

At some point, you will need to store data somewhere. That's what databases are for. In the Microsoft ecosystem, the database engine of choice is SQL Server. There's a book that will teach you the needed bits of SQL (Structured Query Language) as a C# .NET developer: Murach's SQL Server 2012 for Developers (814 pages). At the time of this writing, it targets SQL Server 2012 but if there's a new release focusing on SQL Server 2014, get this one instead.

There's also a new fancy way of interacting with data from a .NET application called "Entity Framework". Many companies use it and Microsoft is putting a lot of effort into it becoming a standard way of manipulating data coming from a relational database. You can optionally read Entity Framework 6 Recipes (550 pages). It will teach you enough EF for your everyday needs.

Master the language

To complete your basic training with C#, there's one book that is not optional and ranks among my all-time favorite programming books: Jon Skeet's C# in Depth (3rd Edition) (616 pages). Learn from it thoroughly. It highlights and explains a lot of concepts many C# developers are not comfortable with. Things like delegates, lambdas, etc.

Now, choose your path

As said in the introduction, C# enables you to create many kinds of software. Web, Windows, Windows Phone, etc. Professional C# 5.0 and .NET 4.5.1 gave you a strong overview of most of the things you can do but now is the time to specialize. Here are some proposals:

Web development

Before you can learn about making web applications, you will need to know HTML, CSS and a bit of JavaScript. If you don't know anything about that, fear not. You can read the excellent Head First HTML and CSS (768 pages) followed by Head First HTML5 Programming (610 pages). The .NET parts you will need are in Pro ASP.NET MVC 5 (825 pages).

Notice that I don't give a path focusing on ASP.NET WebForms and only ASP.NET MVC. That is mostly because that's the direction Microsoft is taking regarding web development for new applications. If you need to work with WebForms, the introduction found in Professional C# 5.0 and .NET 4.5.1 should be enough.

Classic Windows applications

Although, since Windows 8, there's a new paradigm for developing Microsoft Windows apps (the Modern UI ones you launch from the Start screen), classic desktop apps are still heavily used and will continue to be used as well as new ones be created for the forseeable future. If that's your calling, jump in WPF 4.5 Unleashed (864 pages).

Modern Windows 8 apps (formerly known as "Metro Apps")

If you want to create applications for the Modern UI and distribute them through the Windows Store, you'll need to learn the techniques from Programming Windows: Writing Windows 8 Apps With C# and XAML (1136 pages).

Windows Phone apps

There are also mobile apps for the Windows Phone OS. Although the ecosystem is not a thriving one (compared to iOS and Android) with some major players missing (Google, Dropbox, etc), there are still good opportunities to create awesome WP8 apps. The need for WP8 apps can also be driven by corporate requirements. A good book to learn about building Windows Phone apps with C# is Windows Phone 8 Development Internals (1044 pages).

To infinity... and beyond

If you made it this far (reading the books, not this post!), you should now be able to build useful, structured applications. The direction you will take is up to you but keep in mind that like with everything in technology, things change and evolve. You will need to stay up to date with these changes to stay relevant in the field of software development and that is a fact for any technology, not only C# and .NET.

If you have any question, comment or feedback, feel free to contact me or send me a tweet.

back to top | share this on Twitter: