AnyCompiler

Introduction to C#

C# is a compiled, statically typed, garbage-collected language built for the CLR (Common Language Runtime) — Microsoft's equivalent to the JVM. Like Java, C# trades C++'s manual memory management for automatic garbage collection, but it adds its own distinct set of features on top: first-class properties, LINQ for querying collections, delegates and events as a dedicated callback mechanism, and structs as genuine value types alongside classes.

This course's compiler is Mono's C# compiler, not a modern .NET SDK — it supports C# through roughly version 7 (string interpolation, properties, LINQ, generics, tuples) but not later features like switch expressions, records, or top-level statements. Every lesson here stays within what's actually confirmed to compile.

A quick preview

Here's a real C# program, executed for real on this page's own compiler — not a mockup:

using System;

class Program {
    static void Main() {
        Console.WriteLine("C#: strongly typed, garbage collected, and built for the CLR.");
    }
}
Output
C#: strongly typed, garbage collected, and built for the CLR.

That's Console.WriteLine, C#'s standard way to produce output. The next lesson runs your first full program and explains exactly what's happening.

Practice exercise

Declare a variable named version of type int set to 12, then print "C# version: " followed by version using Console.WriteLine.