Field Guide · language

Also known as: C#, C sharp, csharp

C# (pronounced “C sharp”) is Microsoft’s statically typed, garbage-collected, object-oriented language for the .NET platform.1 It is closely comparable to Java — a managed, JIT-compiled language with a large ecosystem — with arguably more modern language features.

.cs source compile IL bytecode .NET CLRJIT + GC native
C# compiles to IL bytecode that the .NET runtime JIT-compiles to native code, with automatic memory management.

Overview

C# compiles to intermediate-language bytecode that the .NET Common Language Runtime (CLR) JIT-compiles to native code at runtime.2 It is statically typed, garbage-collected, and broadly object-oriented with strong functional features. Its lead designer, Anders Hejlsberg, also went on to create TypeScript, and the two share a family resemblance in their type systems.

Strengths and trade-offs

C#’s strengths are a modern, expressive language design, a big ecosystem, and excellent tooling, with trade-offs very similar to Java: managed execution means convenience and safety at the price of a runtime, slower cold starts and higher memory use than native code. Historically the platform was Windows-centric, but .NET is now genuinely cross-platform, running on Linux and macOS as well.

Where it’s used

C# is the backbone of Windows enterprise software and a major language for web backends and cloud services on .NET. Through the Unity engine it also underpins a large share of the game industry. As with Java, the practical choice between the two often comes down to ecosystem and platform rather than the languages themselves.

Sources

  1. C Sharp (programming language) — Wikipedia, for history and design background. 

  2. The C# programming language — Microsoft’s official C# and .NET documentation. 

See also