typestar

Languages

C#

Java's rival that kept evolving after the rivalry ended.

First released
2000 (1.0 in 2002)
Created by
Anders Hejlsberg's team at Microsoft
Typing
Static and strong, with local inference via var
File extensions
.cs, .csx

What it is for

C# is the working language of the Microsoft world and well beyond it: enterprise services on ASP.NET Core, desktop software on Windows, and a surprising share of the games industry, where Unity made C# the default way to script a game. One language covers a web API, a cross-platform mobile app and a game engine, which few of its competitors can claim.

The language itself is the other draw. It started as a cleaner Java and never stopped revising: LINQ brought queries over data into the syntax in 2007, async/await arrived in 2012 and was copied by JavaScript, Python and Rust, and records, pattern matching and top-level programs have steadily stripped the ceremony away. Modern C# in a single file reads closer to a script than to the class-heavy code of its reputation.

The runtime went through the same renovation. .NET was Windows-only for fifteen years; .NET Core rebuilt it as open source in 2016, and today the same SDK compiles and runs on Linux and macOS with performance that regularly embarrasses older stereotypes. The cost is surface area: two decades of accumulated framework mean there are usually three ways to do anything, and the documentation assumes you know which decade you are in.

Where it came from

Microsoft hired Anders Hejlsberg, the designer of Turbo Pascal and Delphi, after a legal fight with Sun over Java ended Microsoft's Java extensions. C# 1.0 shipped with the first .NET Framework in 2002: garbage-collected, class-based, unmistakably Java-shaped, with properties and events from Delphi.

C# 2.0 added real generics in 2005, implemented in the runtime rather than erased like Java's. C# 3.0 built LINQ on top of them in 2007, pulling lambdas, type inference and query syntax into the language in one release. C# 5.0's async/await in 2012 became the pattern nearly every other mainstream language adopted.

.NET Core in 2016 was the turn: open source under the .NET Foundation, cross-platform, developed in the open on GitHub. Since then the language has shipped a version every November — records in 9, global usings in 10, required members in 11 — while the unified .NET runtime replaced the Framework it started on.

What it is like to type

C# types in even, punctuation-heavy lines: braces on their own lines, angle brackets around generics, and PascalCase names that reward committing to the shift key. Interpolated strings mix $", braces and format specifiers in close quarters, and LINQ chains string method calls with lambda arrows, so the middle row gets a workout. The verbosity is regular, which is exactly what makes it good typing practice.

Practice C#

79 steps across 4 tours, from the basics to complete programs.

The tours

Official documentation

Other languages