An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Start with Microsoft Learn’s Get started with C#, Part 1 path—it requires no previous experience and teaches C# through short lessons and beginner projects.^1^
A good learning order
- Print text and learn basic C# syntax.
- Store information in variables, such as names and scores.
- Work with text and numbers.
- Make decisions using
ifandelse. - Complete the guided student grades or GPA calculator project.
Try this small program:
string name = "Alex";
int score = 85;
Console.WriteLine($"Hello, {name}!");
if (score >= 70)
Console.WriteLine("You passed!");
Change the name and score, run it again, and observe how the result changes.
Where to write and run code
The official C# tutorial provides two choices:^2^
- In a browser: Use the tutorial’s GitHub Codespace. This requires a GitHub account but avoids installing development software.
- On a computer: Install the .NET SDK, Visual Studio Code, and C# Dev Kit. The tutorial currently specifies the .NET 10 SDK for its local setup.
For the tutorial’s first program, create hello-world.cs:
Console.WriteLine("Hello, World!");
Run it from the terminal:
dotnet hello-world.cs
What to build next
After finishing Part 1, practice with small projects that interest you:
- Number-guessing game
- Quiz with scores
- Multiplication-table generator
- Grade calculator
- Text adventure with choices
Then continue to the Build .NET applications with C# path to learn projects, debugging, files, dependencies, and eventually a web API.^3^
When an error appears, read the first compiler message and compare the indicated line with your code. Fixing small mistakes—such as missing quotation marks, parentheses, or semicolons—is a normal part of learning.
References