Let’s talk about learning today. Specifically, let’s talk about learning a programming language. What’s the best way to learn C#?
For the most part on this blog, we’ve answered questions that non-programmers might have about the world of programming when they’re thinking of breaking in. And while I suppose learning a programming language could fall into this category, it’s a little more specific.
But I wanted to examine this topic with a blog post for a specific reason. I happened to Google “best way to learn C#” and find that something was consistently missing from the results.
Don’t get me wrong.
The results are helpful. It’s just that they seem to focus exclusively on providing you with lots of links to various tutorials and websites. And while resources certainly matter to your learning process, there’s a lot more to teaching someone a language than just “here’s a bunch of links, go do it.”
So today, let’s talk about learning C#. I’ll definitely offer some suggestions for learning, tutorials, and reading, but I want to answer this question more comprehensively. Here’s the best way, in my opinion, to go about learning this language that I happen to love.
What’s the Best Way to Learn C#? The tl;dr
Alright, so here’s the short version. The best way to learn C# is with a combination of an introduction to the language concepts followed immediately by practice in the form of exercises.
- Read about/watch a video about/learn about a new concept.
- Write a small program (or expand an existing one) in which you reinforce the learning with applied practice.
- Move on and do this with more and more concepts.
- Periodically revisit previous lessons to reinforce them.
After doing this for some time, you’ll have enough tools in your tool chest to begin writing actual programs that you maintain.
But before we can get into the specifics of that, let’s clear up some potential misconceptions around C# that you may have. After all, it’s tough to talk about the best way to learn something when you’re not clear on what, exactly, you’re learning.
C# From a Beginner’s Perspective: Clearing up Some Questions
So let’s first answer some common questions that arise among those looking to learn C#, especially those relatively new to programming.
What is C# Exactly?
Microsoft developed C# in the late 90s and early 2000s in the run-up to its release on the .NET framework (more on that shortly). Thus, its origins are Microsoft-proprietary, though they have, in more recent years, open-sourced pretty much everything in and around the language.
Fun Fact: During its development stage, creators called the language “COOL” for “C-like Object-Oriented Language,” and I really wish the name had stuck.
C# is a highly versatile language that’s in wide use today.
Is C# Web Development?
Let’s clear up the first misconception that you might have. C# is a versatile language, as I just mentioned, which means that it’s not a web development language or, in any way, synonymous with web development.
In fact, in the early days of C#, desktop development represented a much more common usage scenario than the emerging field of web development. Over the years, it has seen widespread adoption for the purpose of web development, but you can also use it for desktop development to this day, as well as embedded systems, back office applications, and mobile apps.
Is C# The Same Thing as .NET?
Onto misconception number 2. What is this .NET thing that people always talk about when they want you to know C#/.NET? Are they the same thing or interchangeable?
Well, if you’re wondering about this, you’re not the only one. The short, easy answer is that C# and .NET are NOT interchangeable and are NOT the same thing.
If you want a detailed, technical explanation, check out the link above to Stack Overflow. What I’ll offer here, instead, is one that sacrifices technical precision for the sake of ease of understanding, assuming you’re not a grizzled programming veteran.
.NET is a framework, but you can think of it as an ecosystem of programming languages. C# participates in that ecosystem, but so do other languages, like Visual Basic and C++. Some of the participating languages, like C++, exist outside the .NET framework. But the creators of C# designed it specifically and exclusively for .NET. (One could argue this point pedantically, but I’d just take it at face value until you’re FAR beyond the tutorial stage.)
So when you learn C#, you’ll immerse yourself in the .NET framework. But C# is a programming language and .NET is the thing that enables you to build and run your C# programs (as well as to do the same in other languages).
Is It Hard to Learn C#?
Now we’re getting into more subjective territory. Is C# hard to learn?
I personally know quite a few different programming languages and will share my opinion here. I think that C# is relatively easy to learn compared to many programming languages.
The reason for this is that the C# language designers did a pretty good job of creating a sort of “easy mode” and “hard mode” as you go. C# has a number of subtle and extremely sophisticated language features that will challenge beginners.
But you can get by perfectly well without those as you learn. The language is approachable.
Is C# Good for Beginners?
As such, I’d say that C# is definitely good for beginners.
It’s approachable and easy enough to reason about. Combine that with its popularity and versatility, and you have a solid choice for your first programming language.
(And no, I wouldn’t recommend trying to learn several programming languages simultaneously if you’re new to programming.)
Learning C#: Techniques and Resources
Alright, let’s get to the business of learning C#. Or, at least, learning the best way to learn it.
I’m going to offer a series of actionable steps to make your acquisition of the language as simple as possible.
1. An Easy Way to Practice: Repl.It!
When I was learning C#, something like 15 years ago now (wow, I’m old), I didn’t have a lot of today’s tools at my disposal. So I look at this first item and think, “wow, what a time to be alive.”
In the programming world, there’s an old concept called a REPL. It basically lets you type in commands in a programming language and see immediate results.
This is an old concept, but the new spin on it is a tool that lets you do it right in your browser, in any programming language, with no overhead. This means that you can start your learning journey in a very hands-on fashion. And you don’t need to buy/install/download/etc anything at all to start.
Here’s what you’ll see (I added the red arrow).
What you’ve got there is a tiny amount of C# code: the code for a so-called “Hello World” program. And the red arrow is pointing to a “run” button, which allows you to run your little program.
Pay attention to the dark window on the right as you do, and check out what happens.
It may not look like much, but you just ran your first C# program. The results are right there: it printed “Hello World.”
Keep this repl.it site in your back pocket as you learn because it’s going to help you try out language concepts very quickly as you progress during your learning.
2. Choose Your Instructor
Finally, many words into this post, we’re arriving at the only thing most “best way to learn C#” tutorials provide: resources. But rather than overwhelm you with options here, I’m going to suggest only a few. (If you want more options, I’ll have a further reading section at the bottom.)
The first thing that I suggest you decide is how you prefer to learn. So, which of the following will it be?
- You can’t beat actual course instruction for effectiveness. If you have the money, time, and drive, you could sign up for a bootcamp.
- Assuming you’re here looking to go the self-taught route, you might favor video content as your preferred style of learning.
- Or, perhaps you prefer reading, be it blogs, online guides, or textbooks.
Here are my recommendations, once you have your chosen course of action in mind.
- I know I said that I would offer specifics, but for a bootcamp, I can’t really recommend one, per se, since this is a major purchase, dependent on your location, budget, etc. Here’s a list of a bunch of C# bootcamps.
- If you like the video instruction route, get yourself a Pluralsight subscription. It’s relatively inexpensive, and their library is GREAT. I’m actually a Pluralsight author and have also used their material for years and years as a consumer as well. Pluralsight’s origins were actually in the .NET community, so they’re absolutely unbeatable for this type of content.
- For written content, I’d go straight to the source. Microsoft offers a curated guide of material designed to get you up and running in C#. (There are certainly books you could buy as well, and I’ll cover some of those, but there’s nothing like a living document, curated by the people who made the language.)
3. Get Your Tooling and Get Started
Now you’ve got a lightweight way to write a little C# code, and you’ve selected your instructor. Next up is your tooling.
You’re going to want to download Visual Studio, which is the mainstay development tool for C#. Now, if you do some research, you may see other options for writing C# code, but don’t worry about that until much later. Visual Studio is powerful, it will help make things easier for you, and it serves as a nice turnkey complement to the lightweight REPL that you can also use.
You’ll want the free community version of Visual Studio, and you can download in these places, depending on your operating system.
- If you’re using Linux, you’re out of luck for Visual Studio and will need to use its lighter-weight cousin, the Visual Studio Code editor. (You’ll be fine—you’ll just have to do a little more work here and there, but if you’re comfortable with Linux, you’re probably already comfortable with that.)
Now you’re ready to start in earnest.
4. Start Building a So-Called Console Application
You’ve now got a lightweight way to try out language concepts, a heavyweight way to write code, and your teacher all lined up.
So go start learning!
Seriously, go do it now. Work the steps that I mentioned in the beginning, learning something, practicing it in your REPL until you’re comfortable, repeating, and revisiting. But you’ll also want to use Visual Studio to start building our more permanent code. This will get you used to the rhythms of C# programming.
But don’t do this with a web application or a mobile app. Start out with a console application, which is basically a text-only system of input and output.
This will help you avoid introducing confusing peripheral concepts until later. In the beginning, focus on the language and logic, without introducing “client-side” stuff to the mix or other frameworks and libraries.
What should you build? It’s up to you, really! You could make a menu driven program that sorts things in alphabetical order, or maybe a text-based video game. Or, if imagination fails you, you could develop a library of solutions to various code katas.
5. Get Started with Github
Once you’ve written enough code in your console project to worry about losing it, you should introduce yourself to the idea of source control. Do this by creating an account on Github and saving it there by essentially uploading it.
This serves more than one function:
- It prevents you from losing your work if your hard drive pukes.
- It allows you to work on your stuff from multiple computers or environments.
- It familiarizes you with source control, the backbone of software development.
- It starts letting you get your work out there in a public, social space where you can interact with others, learn, and show off your work.
If you have a Pluralsight subscription, you can learn about using Github there. Otherwise, Github itself offers a guide to help you get started.
6. Start on and Build a Non-Toy Application
If this were a novel or movie, I’d do some kind of time-lapse thingie here. But it’s not, so I’ll just say, “hey, time has elapsed by the time you’re doing this.”
Specifically, you should have worked through a lot of language concepts and find yourself beyond the basics by now. And that will take time.
But once you’ve done that, iterating through “learn the concept, practice it, and revisit it,” you’re ready to build something non-trivial. For this, you should choose something like a web or mobile app, and have a useful purpose in mind for it. This is your senior project if you will.
Now, when you do this, you’re going to have to give yourself a crash course in a few things:
- You’re going to need to learn to use some kind of GUI framework.
- Almost certainly you’ll need some way to store data, such as in files, but probably in some kind of database.
- Or, you may use cloud services to store and manage data.
- Most likely, you’ll need to interact with third party libraries and APIs.
Are you ready to take that on? You may never feel quite ready, but you’re definitely NOT ready without plenty of practice with the basics.
Assuming you’re ready, create a new Github repository, use your “instructor” to teach yourself these new concepts, and get started! (As an aside, this is one of the main reasons I recommend Pluralsight so much—they have excellent courses on all of these concerns that I’ve mentioned.)
Further Reading/Additional Resources
And that’s it! You should have everything you need at this point to go learn C#. But, in case you’d like further reading to consider, I’ll offer plenty of additional resources.
- Lynda is another option that competes with Pluralsight.
- Ditto Udemy is another Pluralsight competitor.
- Microsoft has its own video academy as well.
- Microsoft has a tutorial walking you through some absolute basics in a REPL.
- Learn C# (“learncs”).
- .NET Academy.
- Beginning C# Object-Oriented Programming.
- Not necessarily for beginners, per se, but Jon Skeet is an absolute C# master, and he has a book C# in Depth.
- C# Programming, a Step by Step Guide for Absolute Beginners.
- C#: The Ultimate Beginner’s Guide to Learn C# Programming Step by Step.
Blogs/News about C# and .NET
- Reddit has a C# sub-Reddit.
- The C# Helper.
- Warning—this is an advanced (but awesome) blog: Eric Lippert’s “fabulous adventures in coding.”
- C# Tutorials.
C# and .NET Podcasts/Video Series
This post was written by Erik Dietrich. Erik is a veteran of the software world and has occupied just about every position in it: developer, architect, manager, CIO, and, eventually, independent management and strategy consultant. This breadth of experience has allowed him to speak to all industry personas and to write several books and countless blog posts on dozens of sites.