C# Tutorial

💻 C# Programming Tutorial for Beginners

1. What is C#? (Super Simple Explanation)

C# (say: “see sharp”) is a modern, beautiful, and very powerful programming language made by Microsoft.

Think of it like this:

  • Python → easy and simple, great for beginners
  • Java → strong but a bit old-school
  • C# → the perfect mix: easy to read like Python, super powerful like Java/C++, and runs really fast!

C# is used everywhere:

  • Games (Unity engine – most mobile & PC games!)
  • Web apps & APIs (like Netflix, Stack Overflow parts)
  • Desktop apps (Windows apps)
  • Mobile apps (with .NET MAUI)
  • Cloud services (Azure)
  • AI, IoT, robotics, automation… literally everything!

2. Quick History (Only the Important Stuff – 2026 Update)

  • 2000 → Microsoft creates C# (led by genius Anders Hejlsberg)
  • 2002 → First version (C# 1.0)
  • 2010 → C# 4.0 – dynamic typing
  • 2012 → C# 5.0 → async/await (made waiting for internet super easy)
  • 2019–2023 → C# 8–12 → records, pattern matching, primary constructors…
  • 2024 → C# 13
  • November 2025C# 14 released with .NET 10 (the version we use today!)

As of January 2026 → The latest & best is C# 14 + .NET 10 (Long-Term Support until 2028 – super stable for real projects!)

3. .NET – The Magic Platform Behind C#

.NET is not just a framework – it’s the home where C# lives. It gives C# all its superpowers!

Old Name Modern Name (2026) Cross-Platform? Recommended?
.NET Framework (2002–2022) Only Windows No No (legacy)
.NET Core (2016–2020) Now just .NET Yes (Win + macOS + Linux + Android + iOS + Browser) YES!

Current best choice (Jan 2026): .NET 10 (LTS – supported until Nov 2028) + C# 14 → Fastest, safest, most modern!

4. Setting Up Your Environment (Two Easy Choices – 2026)

Choice 1: Visual Studio 2026 Community (Recommended for Beginners – Full Power)

  1. Go to: https://visualstudio.microsoft.com/downloads/
  2. Download Visual Studio 2026 Community (100% free!)
  3. Install → Choose these workloads:
    • .NET desktop development
    • ASP.NET and web development (optional but useful)
    • .NET Multi-platform App UI development (.NET MAUI – mobile/desktop)
  4. Install (takes ~20–40 min depending on internet)
  5. Open VS 2026 → Create a new projectConsole App (.NET) → Select .NET 10.0 → Name it “MyFirstApp” → Create!

Choice 2: Visual Studio Code + .NET SDK (Lightweight, Free Forever)

  1. Install VS Code: https://code.visualstudio.com/
  2. Install .NET 10 SDK: https://dotnet.microsoft.com/en-us/download/dotnet/10.0 (Choose the SDK – about 200 MB)
  3. In VS Code → Extensions → Install:
    • C# Dev Kit (by Microsoft – includes everything!)
    • C# (base support)
  4. Open terminal (Ctrl+`) and run:
    Bash
  5. Press F5 → Magic!

5. Your Very First Program – Hello World! 🌍

Open your project and replace everything in Program.cs with this modern C# 14 style (no class or Main needed!):

C#

How to run it?

  • Visual Studio → Press F5 (green play button)
  • VS Code → Press F5 or terminal: dotnet run

You should see:

text

Congratulations! 🎉 You just wrote and ran your first C# program!

6. Let’s Make It Personal – Variables & Input

Now let’s make the program ask for your name!

Update Program.cs:

C#

Run it again → Try typing your name and age!

7. Quick Summary – What We Learned Today

  • C# is modern, powerful, and fun!
  • We use .NET 10 + C# 14 in 2026
  • Two great tools: Visual Studio 2026 or VS Code + .NET SDK
  • Wrote our first Hello World
  • Learned how to read user input (Console.ReadLine())
  • Used variables (string, int)
  • Used string interpolation ($”Hello {name}”) – very clean!

Your Homework (Super Easy & Fun!)

  1. Install one of the setups above
  2. Run the Hello World program
  3. Change it to ask for your favorite color, food, or hobby Example:
    C#
  4. Run it and feel proud! 🎉