DEV Community

Cover image for Let's Go with CSharp!
Leandro Rodrigues Alexandre
Leandro Rodrigues Alexandre

Posted on

Let's Go with CSharp!

Learn C# in 2025: A Beginner-Friendly Guide (With Real-World Examples)
New to programming or switching stacks in 2025? If you’re curious about C#, this guide is for you. I’ll walk you through the first steps — from installing your development environment to writing simple programs that solve everyday problems.

My Setup (But You Can Use Yours Too)
Here’s what I personally use to code in C#:
MacBook Pro M2
IDE: JetBrains Rider — fast, cross-platform, and perfect for .NET development
Terminal: Warp — a modern terminal with AI and smart suggestions
.NET SDK: Latest stable version (like .NET 8 or higher)
You can follow this tutorial on Windows, Linux, or macOS — Rider is optional; Visual Studio Code or Visual Studio also work great!

Step 1: Installing the .NET SDK
To write and run C# code, you need the .NET SDK.
Go to: https://dotnet.microsoft.com/en-us/download
Download and install the latest LTS version (e.g., .NET 8)
Open your terminal and verify the installation:

dotnet --version

Enter fullscreen mode Exit fullscreen mode

Step 2: Create Your First Project
Let’s start with the famous “Hello, World!”

dotnet new console -n HelloWorldApp
cd HelloWorldApp
dotnet run

Enter fullscreen mode Exit fullscreen mode

It will output:

Hello, World!

Enter fullscreen mode Exit fullscreen mode

Welcome to the world of C#!

Step 3: Understanding the Project Structure
A basic console project looks like this:
Program.cs: Where your C# code lives
HelloWorldApp.csproj: Project config
bin/ and obj/: Output folders generated during build
You can open this project in Rider, Visual Studio Code, or any C#-compatible IDE.

What Can You Build With C#?
Here are some everyday use cases:
Automate tasks like file renaming or batch operations
Build your own command-line tools
Create powerful web APIs using ASP.NET Core
Make bots for Telegram, Discord, etc.
Create games with Unity
Work with Excel files and PDFs
Build small utilities to solve personal or work problems

Real-World Example: Email Validator
Here's a simple program to check if an email is valid:

using System.Text.RegularExpressions;

Console.WriteLine("Enter your email:");
var email = Console.ReadLine();

bool isValid = Regex.IsMatch(email, @"^[^@\s]+@[^@\s]+\.[^@\s]+$");

Console.WriteLine(isValid ? "Valid email!" : "Invalid email.");

Enter fullscreen mode Exit fullscreen mode

What's Next? (Stay Tuned!)
In the next articles, I’ll cover:
Variables, data types, and functions in C#
Creating your first calculator
Introduction to Object-Oriented Programming (OOP)
Building your first REST API with ASP.NET Core
Storing data with Entity Framework Core (EF Core)
Writing unit tests in a beginner-friendly way

Final Thoughts
If you enjoyed this guide, drop a comment or follow me here on Dev.to. I’ll be sharing more step-by-step tutorials very soon!

Top comments (0)