C# (C sharp)
termKept in this browser · My desk
Microsoft's managed, garbage-collected language for .NET, whose chief designer is Anders Hejlsberg; C# 1.0 was released in January 2002 with Visual Studio .NET 2002.
Ecma published ECMA-334 in December 2001 (7th edition, December 2023); Microsoft's own history says C# 1.0 "looked a lot like Java"; C# 15 was released in November 2026.
What it is. C# is a strongly typed, object-oriented language for the .NET platform, in the C family of syntax (semicolons, braces, if, switch, for, foreach). Every variable has a type known at compile time; value types such as int, double and char sit beside reference types such as string and arrays; memory is managed automatically by the runtime. Microsoft's overview calls it the most popular language for .NET, a free, cross-platform, open source environment, and lists its signature features: pattern matching, language-integrated query (LINQ) over collections, Extensible Markup Language (XML), JavaScript Object Notation (JSON) and databases, and the task-based async and await model.
Origin. Anders Hejlsberg had been the principal engineer of Turbo Pascal and chief architect of Delphi before joining Microsoft in 1996, where he was architect of Visual J++ and the Windows Foundation Classes before becoming chief designer of C#. Microsoft's own history says C# 1.0, released in January 2002 with Visual Studio .NET 2002, "looked a lot like Java". C# 1.2 followed in April 2003; C# 2.0 (November 2005) added generics, partial types, anonymous methods, nullable value types and iterators; C# 3.0 (November 2007, with Visual Studio 2008, though the full set of features came with .NET Framework 3.5) added lambda expressions, extension methods and query expressions, LINQ being its killer feature. C# 4.0 came in April 2010, and C# 5.0 (August 2012) centred on the async and await model of asynchronous programming. With C# 6.0 (July 2015) Microsoft released Roslyn, a compiler written in C# and offered as a service; C# 8.0 (September 2019) was the first to target .NET Core and brought nullable reference types; since C# 10 (November 2021) a version has come every November, C# 15 in November 2026 with union types and closed hierarchies.
How it works. C# compiles to code managed by the Common Language Runtime (CLR). Compilers emit metadata describing types, members and references, stored in every loadable portable executable (PE) file; the runtime uses it to load classes, lay out instances and check versions, and its garbage collector manages object lifetimes. The type system, metadata format and virtual execution system are defined by Ecma's Common Language Infrastructure (CLI) specification, so objects written in different .NET languages can call and inherit from one another. C# also allows an unsafe context, enabled with the AllowUnsafeBlocks compiler option, in which code may use pointers, the fixed statement and stack allocation to call native functions or avoid bounds checks; Microsoft calls it code whose safety .NET tools cannot verify, and a stricter memory-safety model, in which dereferencing rather than holding a pointer is unsafe, is in preview in C# 15 and .NET 11.
Standards and status. Ecma published ECMA-334 in December 2001; its 7th edition is of December 2023. Ecma's table maps Microsoft's versions to standards of Ecma and of the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC): version 1 to ECMA-334:2003 and ISO/IEC 23270:2003, version 2 to the 2006 editions, versions 3 and 4 to none, version 5 to ECMA-334:2017 and ISO/IEC 23270:2018, version 6 to ECMA-334:2022, and version 7 to ECMA-334:2023 and ISO/IEC 20619:2023, so the standard trails the language by years. The runtime follows Microsoft's .NET support policy: long-term support (LTS) releases get three years of free support and patches, standard-term support (STS) releases two; .NET 10 (LTS, 11 November 2025) and .NET 11 (STS, 10 November 2026) are both supported until 14 November 2028.
What goes wrong. Managed code removed most memory corruption, but serialization brought the Java problem with it. Microsoft's guidance says BinaryFormatter "is insecure and can't be made secure", that calling its Deserialize method on a payload is like launching that payload as an executable, and that deserialization flaws can cause denial of service, information disclosure or remote code execution; since .NET 9 the built-in implementation throws exceptions on use. Other serializers that perform unrestricted polymorphic deserialization are, in Microsoft's words, dangerous just like it. For defenders the practical list is short: find remaining BinaryFormatter use before moving an application to .NET 9 or later, review every project that sets AllowUnsafeBlocks, and keep runtimes inside their support window.
Neighbours. Java, its model and rival; TypeScript, Hejlsberg's later language; Turbo Pascal; Rust, whose reference credits C# for its attributes; type systems and memory safety.
Also known as: c sharp, csharp, ecma-334
Sources
- Microsoft Learn, The history of C#: C# 1.0 released January 2002 with Visual Studio .NET 2002; C# 15 released November 2026 (read 2026-11-23)
- Ecma International, ECMA-334: 1st edition December 2001, 7th edition December 2023 (read 2026-11-23)
- Microsoft Research, Behind the Code with Anders Hejlsberg: principal engineer of Turbo Pascal, chief architect of Delphi, chief designer of C# (read 2026-11-23)
- Microsoft Learn, A tour of the C# language (read 2026-11-23): the most popular language for the free, cross-platform, open source .NET platform; C family syntax; strongly typed; pattern matching, LINQ, async and await; automatic memory management
- Microsoft Learn, Common Language Runtime (CLR) overview (read 2026-11-23): managed code; metadata in every loadable PE file; garbage collection; type system, metadata and virtual execution system defined by the ECMA Common Language Infrastructure specification; cross-language integration
- Microsoft Learn, Unsafe code, pointer types, and function pointers (read 2026-11-23): unverifiable code in an unsafe context; AllowUnsafeBlocks compiler option; fixed and stackalloc; an updated memory safety model in preview in C# 15 and .NET 11
- Microsoft Learn, Deserialization risks in use of BinaryFormatter and related types (read 2026-11-23): BinaryFormatter is insecure and can't be made secure; Deserialize like launching the payload as an executable; DoS, information disclosure or remote code execution; throws on use since .NET 9
- Microsoft, .NET and .NET Core Support Policy, updated 10 November 2026 (read 2026-11-23): LTS releases three years of free support, STS releases two; .NET 11 STS released 10 November 2026 and .NET 10 LTS released 11 November 2025, both supported until 14 November 2028