Skip to main content

📝 Lesson 1.1: What Is C# and .NET?

Before you write your first line of code, let's get the big picture: what C# is, what .NET does for you, and why the two are almost always mentioned together.

🎯 Learning Objectives

By the end of this lesson, you will be able to:

  • Explain in plain language what a programming language is and what C# is used for
  • Describe what .NET is and how it relates to the C# language
  • Trace the journey your code takes from text you type to a program that runs
  • Name several kinds of software that are built with C#

Estimated Time: 30 minutes

Project: No coding yet — this lesson builds the mental model you'll use for the rest of the course.

In This Lesson

Introduction: Talking to Computers

A computer is an extraordinarily fast but completely literal machine. It can add billions of numbers per second, but it has no common sense and no idea what you want — it only does exactly what it is told, step by step.

The problem is that computers "think" in machine code: long streams of 1s and 0s that are almost impossible for humans to read or write. A programming language is the bridge. It lets you write instructions in something much closer to human language, which then gets translated into the machine code the computer actually runs.

C# is one of those languages — and a particularly good one to learn first. It's modern, widely used, well-organized, and it catches many mistakes for you before your program ever runs.

💡 Key idea: Programming is the craft of expressing a task so precisely and unambiguously that a machine can carry it out. Learning a language like C# is learning how to give those precise instructions.

What Is C#?

C# (pronounced "C-sharp", like the musical note) is a programming language created by Microsoft. It first appeared in 2000 and has been steadily improved ever since, with a new version released roughly every year.

📖 Definition

C#: A modern, general-purpose programming language. "General-purpose" means it isn't locked to one kind of task — you can use the same language to build websites, desktop apps, games, mobile apps, and more.

A few characteristics make C# especially friendly for beginners:

  • Readable: Its keywords and structure read fairly close to English.
  • Strongly typed: Every piece of data has a declared kind (a "type"), so the language can warn you about many mistakes before the program runs. You'll see why this is a safety net in Module 2.
  • Object-oriented: It helps you organize larger programs into tidy, reusable pieces (covered in Module 4).
  • Backed by a huge ecosystem: Enormous libraries of ready-made code, great tools, and a large, active community.

✅ Good to know

The name "C#" is a nod to the C family of languages (C, C++). The "#" (sharp) playfully suggests "one step up." You do not need to know C or C++ to learn C#.

What Is .NET?

If C# is the language you write in, .NET (pronounced "dot-net") is the platform that runs it. People often say "C#/.NET" in one breath because you almost always use them together.

Think of it like driving. C# is the language you use to give directions; .NET is the car, the engine, and the roads that actually get you there. .NET is made up of a few parts:

Part of .NET What it is Everyday analogy
The Runtime (CLR) The engine that actually executes your program and manages memory for you. The car's engine
The Class Libraries A giant collection of pre-written, ready-to-use code (for text, dates, files, math, networking, and much more) so you don't reinvent the wheel. A well-stocked toolbox
The SDK & Tools The Software Development Kit: the dotnet command and compiler you use to create, build, and run projects. The workshop and tools

Here's how the pieces relate to one another:

graph TD A["You write C# code"] --> B[".NET SDK builds it"] B --> C["The Runtime (CLR) executes it"] D["Class Libraries
(ready-made code)"] --> C C --> E["Your program runs"] style A fill:#eff6ff,stroke:#3b82f6,stroke-width:2px style E fill:#e8f5e9,stroke:#4CAF50,stroke-width:2px

✅ Cross-platform

Modern .NET is free, open-source, and cross-platform. The same C# program can run on Windows, macOS, and Linux. (You may hear about the older ".NET Framework", which was Windows-only. This course uses modern .NET, sometimes called ".NET Core" in older articles.)

How Your Code Becomes a Program

You type C# as ordinary text in a file. But the computer can't run text directly — it has to be translated. Here's the journey your code takes, and it's a two-step translation that's worth understanding:

graph LR A["Source code
Program.cs
(text you write)"] -->|"compiler"| B["IL
(Intermediate
Language)"] B -->|"runtime / JIT"| C["Machine code
(1s and 0s)"] C --> D["CPU runs it"] style A fill:#eff6ff,stroke:#3b82f6,stroke-width:2px style D fill:#e8f5e9,stroke:#4CAF50,stroke-width:2px
  1. You write source code — human-readable C# saved in a file ending in .cs.
  2. The compiler translates it into an in-between form called Intermediate Language (IL). IL is not tied to any specific type of computer.
  3. The runtime translates IL to machine code for the exact computer it's running on, right when it's needed (this is called Just-In-Time, or JIT, compilation), and the CPU runs it.
⚠️ Why two steps? That intermediate IL step is the secret behind "write once, run anywhere." Because IL isn't tied to one kind of machine, the same compiled program can be turned into the right machine code on Windows, macOS, or Linux.

⚠️ New term: "compile"

You'll hear "compile" constantly. It simply means translating your source code into a form that can run. When someone says "it won't compile," they mean the translator found a problem in the code and stopped — which is actually helpful, because it catches mistakes early.

Where C# Is Used

C# is not a toy language for classrooms — it powers a huge amount of real, professional software. Learning it opens a lot of doors:

Area What you can build Technology (for later)
🌐 Web Websites, web apps, and APIs that power apps and services ASP.NET Core
🖥️ Desktop Windows applications with buttons, windows, and menus WPF, WinForms, .NET MAUI
🎮 Games 2D and 3D games for PC, console, and mobile Unity
📱 Mobile Apps for iOS and Android from one codebase .NET MAUI
☁️ Cloud & Services Background services, cloud functions, and large-scale systems Azure, ASP.NET Core

In this course we'll build console applications — programs that run in a text window. They're the perfect place to learn because there's no visual clutter to distract from the core ideas. Every concept you learn here carries directly into all the areas above.

A First Look at C# Code

You won't run anything yet — we'll set up your tools in the next lesson. But here's a tiny, complete C# program so the language stops being abstract. This program prints a greeting to the screen:

// This is a comment — notes for humans, ignored by the computer.
// The line below prints a message to the screen.
Console.WriteLine("Hello, C#!");

Don't worry about the exact details yet — just notice a few things:

  • The line starting with // is a comment: a note for humans that the computer ignores.
  • Console.WriteLine(...) is an instruction meaning "write a line of text to the console (the screen)."
  • The text in quotes, "Hello, C#!", is the exact message that will appear.
  • The line ends with a semicolon ; — in C#, that marks the end of a statement, like a period ends a sentence.

Output:

Hello, C#!

💡 That's the whole loop

Write an instruction → build it → run it → see the result. Everything else in this course is just learning more powerful instructions to put in that loop.

Reflection & Quick Quiz

🏋️ Reflection Exercise

Objective: Cement the big picture in your own words — no computer required.

Instructions:

  1. In one or two sentences, explain the difference between C# (the language) and .NET (the platform), as if explaining it to a friend.
  2. List three different kinds of software you use every day (a game, a website, a phone app, etc.). For each, note that a language like C# could be used to build it.
  3. In your own words, describe what it means to "compile" code.
💡 Hint

Reread the "driving" analogy in the .NET section: the language is how you give directions; the platform is the car and roads that get you there. For "compile," think of translating a document from one language to another.

✅ Sample Answer

1. C# is the language I write instructions in; .NET is the platform — the engine, tools, and ready-made code — that builds and runs those instructions.

2. A mobile game (could be built with C# in Unity), a shopping website (could use ASP.NET Core), and a desktop note-taking app (could use .NET MAUI or WPF).

3. Compiling means translating the C# text I wrote into a form the computer can actually run. If the compiler finds a problem, it stops and tells me, so I can fix it before running.

🎯 Quick Quiz

Question 1: What is the best description of the relationship between C# and .NET?

Question 2: What does it mean to "compile" a program?

Question 3: Which of these can be built with C#?

Summary

🎉 Key Takeaways

  • A programming language lets you write instructions in a human-friendly form that gets translated into machine code.
  • C# is a modern, readable, general-purpose language created by Microsoft — an excellent first language.
  • .NET is the platform that runs C#: a runtime (engine), class libraries (ready-made code), and the SDK/tools. It's free, open-source, and cross-platform.
  • Your code travels from source → IL → machine code; that intermediate step is what lets C# run on many operating systems.
  • C# powers real software everywhere: web, desktop, games, mobile, and the cloud.

📚 Additional Resources

🚀 What's Next?

Now that you understand what C# and .NET are, it's time to get them onto your computer. In Lesson 1.2: Setting Up Your Environment, we'll install the .NET SDK and a code editor — with steps for both VS Code and Visual Studio — so you're ready to write and run real programs.

🎉 Great start!

You've built the mental model that everything else rests on. Next up: getting your tools ready.