Welcome to the introduction to C# tutorials. These lessons start with interactive code that you can run in your browser. You can learn the basics of C# from the C# for Beginners video series before starting these interactive lessons.
The first lessons explain C# concepts using small snippets of code. You'll learn the basics of C# syntax and how to work with data types like strings, numbers, and booleans. It's all interactive, and you'll be writing and running code within minutes. These first lessons assume no prior knowledge of programming or the C# language. Each lesson builds on the prior lessons. You should do them in order. However, if you have some programming experience, you can skip or skim the first lessons and start with any new concepts.
You can try these tutorials in different environments. The concepts you'll learn are the same. The difference is which experience you prefer:
In the Hello world tutorial, you'll create the most basic C# program. You'll explore the string
type and how to work with text. You can also use the path on Microsoft Learn training.
In the Numbers in C# tutorial, you'll learn how computers store numbers and how to perform calculations with different numeric types. You'll learn the basics of rounding, and how to perform mathematical calculations using C#.
In the Tuples and types tutorial, you'll learn to create types in C#. You can create tuples, records, struct, and class types. The capabilities of these different kinds of types reflect their different uses.
The Branches and loops tutorial teaches the basics of selecting different paths of code execution based on the values stored in variables. You'll learn the basics of control flow, which is the basis of how programs make decisions and choose different actions.
The List collection lesson gives you a tour of the List collection type that stores sequences of data. You'll learn how to add and remove items, search for items, and sort the lists. You'll explore different kinds of lists.
Set up your local environment
After you finish these tutorials, set up a development environment. You'll want:
Installation instructions
On Windows, this WinGet configuration file to install all prerequisites. If you already have something installed, WinGet will skip that step.
- Download the file and double-click to run it.
- Read the license agreement, type y, and select Enter when prompted to accept.
- If you get a flashing User Account Control (UAC) prompt in your Taskbar, allow the installation to continue.
On other platforms, you need to install each of these components separately.
- Download the recommended installer from the .NET SDK download page and double-click to run it. The download page detects your platform and recommends the latest installer for your platform.
- Download the latest installer from the Visual Studio Code home page and double click to run it. That page also detects your platform and the link should be correct for your system.
- Click the "Install" button on the C# DevKit extension page. That opens Visual Studio code, and asks if you want to install or enable the extension. Select "install".