The Origins of C#: Microsoft's Answer to Java

Fractional CTO · Founder of Injuria.ai
Some languages are born from research, some from frustration. C# was born from a legal fight. In the late 1990s Microsoft shipped a popular version of Java called Visual J++, and Sun Microsystems sued over Windows-specific extensions that broke Java's run-anywhere promise. Microsoft lost the ability to ship its own flavor of Java. Rather than retreat, it decided to build a modern language of its own, free of anyone else's control, and to put a whole new platform underneath it. That language was C#, and the decision to build it served Microsoft far better than winning the lawsuit ever could have.
Born from a Java fight
The Sun lawsuit left Microsoft needing a strategic answer. It wanted a language with the productivity and safety that had made Java popular, the object orientation, garbage collection, and strong typing, but one it fully owned and could evolve on its own schedule. It put Anders Hejlsberg in charge of language design.[8]
Hejlsberg was the obvious choice. He had created Turbo Pascal, led the Delphi project, and had, until shortly before, been the architect behind Microsoft's own Java work. C# was announced in 2000 and released in 2002 alongside the first version of the .NET Framework.[1][9] The family resemblance to Java was clear and intentional. So was the ambition to do better.[10]
Standardized on purpose
Here is the move most histories skip, and it is the one that mattered most. Rather than keep C# as a proprietary Microsoft product, Microsoft submitted them to Ecma, which later submitted them to ISO. C# became ECMA-334 and the runtime became ECMA-335, the Common Language Infrastructure.[2][3] This was not bureaucracy for its own sake. A rival had just sued Microsoft over control of a language, and standardizing C# was how Microsoft told the industry that this one would not be a trap. It also, crucially, made it legal and possible for other people to build their own implementations, which is exactly what happened.
The .NET platform
C# never ran alone. It was the flagship language of .NET, a platform built on the same portability idea that made Java work. C# code compiles to the Common Intermediate Language, or CIL, which runs on the Common Language Runtime, a managed environment that handles memory, security, and execution.[1][9] The runtime was designed from the start to host more than one language, so Visual Basic, and later F#, could compile to the same intermediate form and share one enormous, well-designed class library.
Learning from Java and then passing it
Because C# arrived a few years after Java with a strong architect, it could learn from Java's early mistakes and move faster. C# 2.0 added generics in 2005, and it did so better than Java in a specific, technical way: C# generics are reified, meaning the type information survives to runtime, where Java erases it at compile time for backward compatibility.[1] That sounds like trivia until you hit the day a Java program cannot tell a list of strings from a list of numbers at runtime and a C# program can. C# 3.0 then introduced LINQ in 2007, which let you write type-checked queries over data, collections, databases, and XML directly in the language.[11]
var adults = people.Where(p => p.Age >= 18)
.Select(p => p.Name);
That style of expressing queries as ordinary checked code was ahead of its peers and widely copied later. My honest opinion is that C# has been, for most of its life, the best-designed mainstream language that developers outside the Microsoft world simply refused to look at, and that it evolved faster than almost any rival while staying coherent.
The feature the web borrowed
C# 5.0, released in 2012, introduced the async and await keywords, a clean way to write code that waits on slow operations without blocking or collapsing into nested callbacks.[11] The idea was not invented from nothing, it drew on the asynchronous workflows in Microsoft's own F#, but C# is where it reached a mass audience. The model then jumped the fence. JavaScript adopted the same async and await syntax in ECMAScript 2017, and it is now how most of the web handles asynchronous work.[5] If you write modern JavaScript, you are using a pattern a supposedly follower language made mainstream.
Breaking free of Windows
C# is often described as having been trapped on Windows for its first decade, and that is only half true. Microsoft's own stack was Windows-only, yes. But because the language and runtime had been standardized, an open-source implementation called Mono, started by Miguel de Icaza in 2001, brought C# to Linux, macOS, and eventually mobile devices long before Microsoft itself went cross-platform. Mono became the foundation for Xamarin's mobile apps and for the scripting layer of the Unity game engine.[4][12] The standardization bet from 2001 was quietly paying off the whole time.
Microsoft made it official starting in 2016 with .NET Core, a rebuilt, open-source, cross-platform version of the platform developed in the open on GitHub, with the compiler itself rewritten in C# as the open-source Roslyn project. The separate editions later unified under a single modern .NET.[7] A language that symbolized Microsoft's closed ecosystem became one of its most credible open-source efforts.
The setback that became the strategy
C# today is a strong choice for web applications through ASP.NET Core, it reaches the browser through Blazor, which can run C# either on the server or directly in the browser on WebAssembly, and it is the language of Unity, which makes it one of the most common languages in all of game development.[6][12] None of that was the plan in 1998. The plan was to answer a lawsuit. What Microsoft actually built was a language good enough and open enough to outgrow the question that created it, and the lesson I take from it is that the standardization nobody noticed, not the features everybody praises, is what kept C# from ending up as a historical footnote next to Visual J++.
Sources (12)
- Microsoft Learn: The history of C#
- Ecma International: ECMA-334 (C# Language Specification)
- Ecma International: ECMA-335 (Common Language Infrastructure)
- The Mono Project: History
- MDN Web Docs: async function
- Microsoft Learn: ASP.NET Core Blazor
- Microsoft Learn: .NET and .NET Core support policy
- Anders Hejlsberg, Mads Torgersen, Scott Wiltamuth, The C# Programming Language (Covering C# 4.0) (Addison-Wesley Professional, 2010)
- Ben Albahari, Peter Drayton, Brad Merrill, C# Essentials ("O'Reilly Media, Inc.", 2002)
- Harvey M. Deitel, Paul J. Deitel, C# for Programmers (Prentice Hall Professional, 2005)
- Marcin Jamro, C# Data Structures and Algorithms (Packt Publishing Ltd, 2024)
- Wouter van Toll, Arjan Egges, Jeroen D. Fokker, Learning C# by Programming Games (Springer Nature, 2019)