Here’s what you will need to learn C#:
You’re learning computer programming, so you’re gonna need a computer. It could be a PC running Windows or Linux, or a Mac. Whatever you’re most comfortable with. Make sure it’s got a keyboard and a monitor, though. You need the keyboard to type the magic programming words, and a monitor so you can see what you’ve typed and also what happens when the program runs.
We’re going to do a lot of stuff from the Command Line Interface or CLI. Mac and Linux systems have one of these out of the box, usually called Terminal, but the one built into Windows is rubbish, so we’re gonna have to upgrade it.
There are a couple of things to install for Windows. Note that you should install them in this order because then the second one will know about the first one without you having to do anything complicated.
First off, you want PowerShell. This is a shell, which is a thing you type commands into and stuff happens. There’s a version of PowerShell that comes with Windows but it’s old and old things are bad, so you should install the new version.
Go to github.com/PowerShell/PowerShell/releases and download the
MSI installer for Windows. While I’m writing this the latest version is 7.1.4, so the installer for that is
PowerShell-7.1.4-win-x64.msi
. Just download it and run it.
The next thing is Windows Terminal, which is a replacement for the built in console app that is used to run PowerShell or the Command Prompt by default. Terminal is much nicer. It’s got tabs and all sorts of mad stuff which, honestly, I don’t use most of it but the tabs are brilliant.
You get Terminal from the Windows Store. You can go to Store from the Start Menu and search for Terminal, or, if you’re reading this on a Windows PC you could just click this link which should take you right there. (You’ll get a browser thing saying This site is trying to open Microsoft Store or something similar; just click Open or OK or Yes or whatever.)
Once it’s installed run it and you should see something like this:
You’re going to be learning C# 10 and .NET 6, because that’s the newest version and newer is always better. Right now (I mean “now” while I’m writing this, not “now” when you’re reading it. I have no idea when that is.) .NET 6 is so new it’s in Preview, but it’s pretty much finished already so we’ll be OK.
If you’re on Windows or Mac, you can get the installer from dotnet.microsoft.com/download/dotnet/6.0 and just run it.
If you’re on Linux it’s a bit more complicated, because everything is a bit more complicated on Linux. So you have to download an installer shell script and run it, which looks like this:
mkdir $HOME/dotnet_install && cd $HOME/dotnet_install
curl -L https://aka.ms/install-dotnet-preview -o install-dotnet-preview.sh
sudo bash install-dotnet-preview.sh
After you’ve installed .NET go to your Terminal and run dotnet --version
. The output should look something like
6.0.100-preview.7.21379.14 which means it’s OK and you’re almost ready to get going.
(If you get an error try closing and re-starting your Terminal.)
This is the last thing, I promise.
Programming is mostly about editing text files, so you need a text file editor. There are lots and lots of different editors out there, but for working with C# it generally comes down to one of three: Code, Visual Studio and JetBrains Rider. We’re going to use Code because it’s nice and simple and supports the latest version of .NET.
Code is a free, open source editor from Microsoft, and there is a C# extension for it that works really well. There are also a million other extensions that do all sorts of cool stuff, but don’t worry about those for now.
Install Code from the Download page, then run it. Click the Extensions icon
on the left - it’s the one with four squares where one of them is flying off to start a new life as a circus performer.
Type C#
in the search box at the top of the Extensions panel, select C# in the list, and click the Install button
on the information page. That’s it! You’re ready to go.