Introduction to C# and .NET

C# (pronounced 'C Sharp') is a modern, object-oriented programming language developed by Microsoft.

C# is part of the .NET ecosystem and runs on the Common Language Runtime (CLR).

First released in 2002 with Visual Studio .NET.

C# was designed by Anders Hejlsberg, the creator of Turbo Pascal and Delphi.

C# is a type-safe, managed language with automatic garbage collection.

C# supports multiple programming paradigms: object-oriented, functional, imperative, and generic.

C# code is compiled to Intermediate Language (IL) which runs on the CLR.

C# versions are released regularly with new features (C# 14 ships with .NET 10 LTS, and C# 15 with .NET 11, released November 2026).

C# is used for: Windows applications, web APIs, games (Unity), mobile apps, and cloud services.

The .NET platform includes: Base Class Library (BCL), CLR, and language compilers.

Modern .NET is cross-platform, running on Windows, Linux, and macOS.

C# is standardized by ECMA and ISO.

Example of a simple C# program:

using System;

class Program
{
  static void Main()
  {
    Console.WriteLine("Hello, C#!");
  }
}

How a C# program runs:

  1. The compiler (Roslyn) turns source code into IL, stored in an assembly (.dll or .exe).
  2. The CLR loads the assembly.
  3. The JIT compiler converts IL into native machine code as the program runs.
  4. The garbage collector frees memory that is no longer used.