Trending upward

The Curious Rise of C#

Michael Shpilt
© Shutterstock / Shutter_M

In the last year, C# is back. What’s driving the rise? The TIOBE Index, which is based on search traffic, and GitHub Octoverse, based on commits to public code repositories, both showed C# ticking up in usage. This article examines some of its popular uses.

Programming languages rise and fall in popularity as new languages are invented to solve new problems or respond to new use cases. Popular old languages never truly die off as long as their old applications are still deployed. COBOL, designed more than 60 years ago, is not only in wide use, but it’s even in demand as programmers are needed to maintain antiquated but functional systems. But declines in usage are usually permanent. Once a language begins to lose popularity, it’s unusual to see it make a comeback.

Nevertheless, that’s exactly what’s happening to C#. The TIOBE Index, which is based on search traffic, and GitHub Octoverse, based on commits to public code repositories, both showed C# ticking up in usage.

SEE ALSO: Python Developer Survey: 84% use Python as main language

A challenge to Java

C# was launched by Microsoft 20 years ago as part of the .NET framework. It was Microsoft’s answer to Java both in form and function with the goal of keeping customers tied into Windows. C# rose in popularity rapidly, peaking in 2010-2012.

While it was never the most popular language with glitzy Silicon Valley startups, C# was adopted by banks, governments, and other large enterprises that were heavily invested in Microsoft’s ecosystem. After that peak, though, C# began to lose ground while challengers like Python, Ruby, and Node.js gained.

And yet, in the last year, C# is back. What’s driving the rise?

The transformation of Microsoft

One factor that might have previously limited C#’s reach is that it was primarily used in the closed-source .NET framework on Windows — it didn’t run on Linux. 2012 was a bad year for Microsoft, their new Windows 8 desktop operating system was unpopular, and the company represented the antithesis of open-source.

Microsoft, as a company, has completely changed. Giving up on walled gardens, MS has embraced the Open Source movement. As well as hiring some of the best developer advocates, promoting open-source projects and buying GitHub, Microsoft also created an open-source version of the .NET framework called .NET Core. Core runs on MacOS and Linux as well as Windows, making it a more versatile choice and a great alternative to Java for broad enterprise use. The Github project is one of the most active, with more than 60,000 contributors.

Further expanding the reach of .NET core is cloud support. Even serverless .NET is no longer tied to Microsoft’s excellent Azure cloud; users can run .NET serverless functions natively on Amazon Web Services too. All of this makes C# a great choice for new projects.

The right tools

C# is also a language with excellent tooling. Microsoft’s own Visual Studio IDE is in its element with C#. It’s consistently rated one on the top two IDEs according to StackOverflow’s yearly survey on development tools. Additional tools allow it to be written and debugged locally or in the cloud. Microsoft looks after its languages and supports a thriving community of third-party developer productivity tools.

Right for gaming

Another unexpected factor in the resurgence of C# comes from the world of gaming.

The popular Unity gaming engine opened up videogame building to hobbyists and AAA game studios alike. The platform-agnostic engine allows developers to build games that can work on Windows PCs, Macs, via web browsers and on phones. Games like Kerbal Space Program, Hearthstone, and Angry Birds 2 were built and powered using the flexible engine.

Unity is mostly operated via a GUI, but it also allows scripting. While Unity used to support various languages, since 2017, the primary language for Unity scripting is…C#. Budding game producers, from schoolkids to professionals, are learning and writing in C# to build their next hit.

SEE ALSO: Quarkus – an IO thread and a worker thread walk into a bar: a microbenchmark story

No more surprises

Where will C# go from here? It’s hard to predict; all of these language measurements are relative percentages. But we mustn’t forget that more people are coding every year. Even a language that seems to be losing percentage share can actually have more users and more lines of code than the year before.

C#, though, is on the march. And with .NET core, the best tooling and debugging, and Unity to drive its adoption, it will keep going from strength to strength.


Michael Shpilt

Michael is a software developer, C# enthusiast, author, and blogger. He writes about C#, .NET, memory management, performance, and solving difficult problems in .NET. When he’s not writing blogs, he’s a lead developer at Ozcode, where he builds debugging solutions for C# and .NET.

Leave a Reply