Chapter 1: Introduction to C# and .NET
1. What is C#? (Simple & Clear Explanation)
C# (pronounced “C Sharp”) is a modern, powerful, and very popular programming language created by Microsoft.
Think of it like this:
- C → is the grandfather (very old, powerful but tricky)
- C++ → is the father (more features, but still complicated)
- C# → is the cool, modern son — easier to use, safer, and does almost everything the parents can do (and more!)
C# was designed to be:
- Object-oriented (we’ll talk about this a lot later — it’s super important!)
- Type-safe (helps you avoid silly mistakes)
- Simple yet powerful
- Beautiful syntax (many developers say it’s one of the nicest-looking languages)
2. Brief History of C# (Just the Important Parts)
- 2000 — Microsoft announces C# at the Professional Developers Conference (PDC). Anders Hejlsberg (the creator of Turbo Pascal & Delphi) leads the team.
- 2002 — C# 1.0 is released together with .NET Framework 1.0. It was basic but already very good!
- 2005 — C# 2.0 — Generics arrive (huge for performance and safety)
- 2007 — C# 3.0 — LINQ (one of the biggest game-changers ever!)
- 2010 — C# 4.0 — Dynamic typing, named & optional parameters
- 2012 — C# 5.0 — async/await (made asynchronous programming beautiful)
- 2017 — C# 7.0 — Tuples, pattern matching, local functions
- 2019 — C# 8.0 — Nullable reference types, default interface methods
- 2021 — C# 10 — Global using directives, file-scoped namespaces
- 2022 — C# 11 — Raw string literals, required members
- 2023 — C# 12 — Primary constructors, collection expressions
- 2024 — C# 13 — Enhanced params collections, new lock object, partial properties, field keyword (preview in VS 17.12+)
- 2025 — C# 14 — Released with .NET 10 (November 2025) — brings even more modern features like extension members, user-defined compound assignment operators, and more performance & productivity improvements
As of January 2026, the latest stable version is C# 14 (released with .NET 10 in November 2025). C# 14 is what most new projects should use today!
3. What is the .NET Ecosystem? (2026 Edition)
.NET is the platform (like the house) where C# (the language) lives and works.
Think of .NET as a big toolbox that gives C# all the power to:
- Run fast
- Work on Windows, macOS, Linux
- Build web apps, mobile apps, desktop apps, games (Unity), cloud services, AI apps, IoT, etc.
Two Big Branches (Very Important!)
| Feature | .NET Framework (old) | .NET (modern, recommended) |
|---|---|---|
| Release years | 2002 – 2022 | 2016 – present (formerly .NET Core) |
| Cross-platform? | Only Windows | Windows + macOS + Linux + Android + iOS + Browser (WebAssembly) |
| Latest version (Jan 2026) | 4.8.1 (still supported but no new features) | .NET 10 (LTS – Long Term Support until Nov 2028) |
| Performance | Good | Much faster (AOT compilation, better GC, etc.) |
| Recommended for new projects? | No | Yes! |
Current .NET Versions (as of January 2026)
| Version | Release Date | Type | Support Until | Status |
|---|---|---|---|---|
| .NET 10 | November 2025 | LTS | November 2028 | Latest & Best |
| .NET 9 | November 2024 | STS | November 2026 | Active |
| .NET 8 | November 2023 | LTS | November 2026 | Active |
Recommendation for 2026: Start new projects with .NET 10 + C# 14 (It’s the most modern, fastest, and supported for the longest time!)
4. Setting Up Your Environment (Step-by-Step – Super Detailed)
You have two excellent choices in 2026:
Option A: Visual Studio 2026 (Recommended for Beginners – Full Power)
- Go to: https://visualstudio.microsoft.com/downloads/
- Download Visual Studio 2026 Community (it’s free for individuals, students, open-source, small teams!)
- Run the installer
- In the workloads screen, select:
- .NET desktop development
- ASP.NET and web development (if you want web apps)
- .NET Multi-platform App UI development (for mobile/desktop with .NET MAUI)
- Game development with Unity (optional)
- Click Install (it will download ~5–10 GB depending on what you choose)
- After installation → Open Visual Studio → Create a new project → Choose Console App (.NET) → Select .NET 10.0 → Done!
Option B: Visual Studio Code + .NET SDK (Lightweight & Free Forever)
- Download & install Visual Studio Code: https://code.visualstudio.com/
- Install .NET 10 SDK:
- Go to: https://dotnet.microsoft.com/en-us/download/dotnet/10.0
- Download the SDK (not just runtime) for your OS
- Install it (very small ~200 MB)
- Open VS Code → Go to Extensions (Ctrl+Shift+X) → Search & install:
- C# Dev Kit (official Microsoft extension — includes IntelliSense, debugging, testing, etc.)
- C# (the base language support)
- Open a folder → Create a new console app:
Bash012345678dotnet new console -o MyFirstAppcd MyFirstAppcode .
- Press F5 to run — magic! 🚀
Quick Test – Your First “Hello World”
Create a file Program.cs (or it’s already there if you used dotnet new):
|
0 1 2 3 4 5 6 7 8 9 10 11 12 |
// Top-level statements (modern C# style - no class or Main needed!) Console.WriteLine("Hello, World! 🌍"); Console.WriteLine("Welcome to C# in 2026! 🚀"); // Press any key to exit (optional) Console.WriteLine("\nPress any key to close..."); Console.ReadKey(); |
Run it:
- In Visual Studio → F5
- In VS Code → F5 or terminal: dotnet run
You should see:
|
0 1 2 3 4 5 6 7 8 9 |
Hello, World! 🌍 Welcome to C# in 2026! 🚀 Press any key to close... |
Congratulations! 🎉 You just ran your first C# program!
Homework for Next Class
- Install either Visual Studio 2026 or VS Code + .NET 10 SDK
- Create and run the Hello World program above
- Change the message to something fun about yourself (e.g., “Hi, I’m learning C# and loving it! 😍”)
- Run it again and feel proud!
In the next chapter, we’ll talk about Variables, Data Types, and start writing real code. Get ready — it’s going to be fun!
