EMZETT.
Login

C#

In short: An object-oriented programming language developed by Microsoft, running on the .NET framework.

In more detail: Syntactically closely modelled on Java and C++ (curly braces, static typing), but with modern language extensions like LINQ, async/await and nullable reference types. Used mainly for Windows applications, Unity game development and backend services with ASP.NET.

In Depth

Origin and development

C# was developed at Microsoft starting in 1999 under the direction of Anders Hejlsberg (previously chief architect of Borland’s Delphi) and unveiled in 2000 together with the .NET Framework. From the start, the language was intended as a modern, type-safe alternative to Java — Microsoft had previously had a legal dispute with Sun over its own, incompatible Java variant (J++), and C# was in many ways the independent continuation of these ideas. To this day, C# regularly adopts concepts from languages like F#, Haskell or TypeScript (e.g. pattern matching, records, nullable reference types) and is now considered one of the most feature-rich mainstream languages of all.

LINQ and functional elements

A well-known C# feature is LINQ (“Language Integrated Query”) — it allows data queries to be formulated directly in the language itself, similar to SQL queries, instead of manually iterating through collections:

var expensiveProducts = products
    .Where(p => p.Price > 100)
    .OrderBy(p => p.Name)
    .Select(p => new { p.Name, p.Price })
    .ToList();

LINQ works not only on in-memory collections, but also on databases (via Entity Framework, LINQ-to-SQL automatically translates the query into real SQL) and XML documents — the same query syntax works across very different data sources.

Asynchronous programming

async/await is one of the most defining C# features and was later adopted by many other languages (JavaScript, Python, Rust, Kotlin). It allows asynchronous code (e.g. network calls) to be written as if it were synchronous, without blocking the thread in the meantime:

public async Task<Product> LoadProductAsync(int id)
{
    var response = await httpClient.GetAsync($"/api/products/{id}");
    var json = await response.Content.ReadAsStringAsync();
    return JsonSerializer.Deserialize<Product>(json);
}

Platform and ecosystem

C# originally ran exclusively on Windows (.NET Framework), but has been cross-platform and open source since .NET Core (2016, now unified as ”.NET”) — programs now run just as well on Linux and macOS, and Microsoft itself runs large parts of its cloud infrastructure (Azure) on .NET. Besides classic application development, C# is especially widespread in gaming through the Unity game engine, where it serves as the scripting language for game logic — most indie games and many AAA titles use Unity+C#. Other important use cases: ASP.NET (web backends), .NET MAUI (cross-platform apps, successor to Xamarin) and Blazor (web frontends in C# instead of JavaScript).

Compared to Java, C# is more progressive in language development in many areas (real properties, operator overloading, nullable value types, LINQ) — Java often catches up on individual features years later. Compared to C++, C# deliberately forgoes manual memory management (garbage collection instead of manual new/delete pairs) and pointer arithmetic, which makes development safer but, in exceptional cases (e.g. game engines with hard performance requirements), less controllable — C# offers an escape hatch for low-level access via unsafe blocks when it’s really needed.

See also: Java, C++, ASP