Introduction to C#: Where to Start in 2025 in Practice
C# (pronounced "C sharp") is a modern, multi-paradigm programming language from Microsoft that is part of the .NET ecosystem. In 2025, C# remains one of the most in-demand languages for developing desktop applications, web services (ASP.NET Core), mobile applications (Xamarin / .NET MAUI), and even games on Unity. If you have decided to start learning C# from scratch, this guide will help you take your first practical steps.
Why Learn C# in 2025?
C# is actively evolving. Annual updates bring new features, improved performance, and code security. Key advantages of the language:
- Cross-platform: .NET runs on Windows, Linux, and macOS.
- Strong typing: helps avoid many errors at compile time.
- Large community: many libraries, tools, and ready-made solutions.
- High salary: C# developers are in demand on the job market.
Step 1: Installing .NET SDK and Setting Up the Environment
The first practical step is to install the .NET SDK (Software Development Kit). This is a set of tools needed to compile and run C# programs.
- Go to the official website dotnet.microsoft.com.
- Download the latest version of the .NET SDK (as of 2025, this is .NET 9 or .NET 10).
- Install the SDK by following the installer instructions.
- Open a terminal (command line) and verify the installation with the command:
dotnet --versionIf you see a version number, everything is ready. For writing code, you can use any text editor (Notepad++) or a full-fledged IDE, such as Visual Studio Community (free) or Visual Studio Code with the C# extension.
Step 2: Creating Your First Console Program
Let's create a simple console application that outputs a greeting. Open a terminal and run the commands:
mkdir MyFirstAppcd MyFirstAppdotnet new consoleThese commands will create a project folder and generate the Program.cs file. Open it in an editor. You will see something like this:
// See https://aka.ms/new-console-template for more informationConsole.WriteLine("Hello, World!");Change it to a more detailed example:
using System;
class Program{ static void Main(string[] args) { Console.WriteLine("Enter your name:"); string name = Console.ReadLine(); Console.WriteLine($"Hello, {name}! Welcome to the world of C#."); }}Run the program with the command:
dotnet runThe program will ask for a name and then greet you. Congratulations, you have written your first interactive C# program!
Step 3: Basics of Syntax in 10 Minutes
Let's break down the basic language constructs. C# is a strongly typed language, so every variable must have a declared type.
Variables and Data Types
int age = 25; // integerdouble price = 19.99; // floating-point numberstring city = "Moscow"; // stringbool isStudent = true; // boolean valueConditional Statements
if (age >= 18){ Console.WriteLine("You are an adult.");}else{ Console.WriteLine("You are a minor.");}Loops
for (int i = 0; i < 5; i++){ Console.WriteLine($"Iteration number {i}");}Methods (Functions)
static int Sum(int a, int b){ return a + b;}
// Method call