C# For Beginners
Search…
⌃K

Getting Started

How The Tutorial Works

The tutorial is divided into a number of lessons. Each lesson introduces new concepts, and sample code is displayed to demonstrate those concepts.
If possible, try not to copy-paste the code. Instead, type out each line. You will start building coding "muscle memory" this way.
At the end of a lesson, the tutorial will test your knowledge. There will be questions or challenges for you to complete yourself.
Make sure that before you tackle them, you understand what exactly the question or challenge is asking for.
Beginner programmers sometimes get stuck because they go through lessons too fast. Going too fast can cause you to make mistakes. A small mistake can radically change your understanding of a concept.
If you find yourself unable to solve a challenge, go through the lesson again. Don't be afraid to go slow: you might have missed something small.
C# can be very strict. You need to ensure that your code is precise and follows the structure expected.

Set Up Your Workspace

You'll use Dotnet Interactive Notebooks as your workspace. It's an extension for Visual Studio Code (a code editor) that allows you to write and run C# code directly in a virtual notebook.
Tip
Visual Studio Code and the Dotnet Interactive Notebooks extension can be downloaded as a single installer. Go to the Dotnet "Learn to Code" website and download the ".NET Coding Pack".
First, download and install the latest Dotnet from the Dotnet website. The minimum version needed by Dotnet Interactive Notebooks is 5.0.
Download and install Visual Studio Code.
Launch Visual Studio Code. You'll see a screen similar to this one.
Open the Extensions panel by clicking the button on the sidebar, or from the menu bar by clicking on View then selecting Extensions.
Type ".NET Interactive Notebooks" in the search bar on the Extensions panel. Click on the Install button to install the extension.
Create a new Notebook by opening the Command Palette (Ctrl-Shift P in Windows, Command-Shift P on Mac) and selecting ".NET Interactive: Create new blank notebook".
You can also use keyboard shortcuts: Ctrl-Shift-Alt N (on Windows) or Command-Shift-Alt N (on Mac) to create the notebook.
Select "Create as .dib" in the next section.
Next, select "C#" as the language.
The .NET Interactive files will download if they haven't been installed yet.
When you see this screen, the notebook is ready! You can write C# code in the box.
To run the code, click on the Execute button on the left-hand side, or use the keyboard shortcut: Ctrl-Alt Enter (on Windows), Command-Alt Enter (on Mac).
Last modified 1yr ago