Yesterday I wrote about C++ and how much I like it. There are several other languages I use though and also like, and we’ll look at those over the coming days, starting with C# today. C# is an interesting language as there was a strong push for it in the .NET Framework 2.0 days, then .NET didn’t turn out to be that huge of a deal, and recently with .NET core it’s been coming back due to first-class support for cross-platform development.
What I like about C# are actually two very separate things, one of them not being actually the language itself but the access to the .NET framework/standard library. It is however quite clear that the .NET framework is targeted for C#, and it’s in my opinion one of the best designed and comprehensive language frameworks out there. The core library not only covers all my day-to-day use cases, but it does so with a consistency that is hard to find elsewhere. This extends to most of it’s ecosystem as well, as the .NET tooling allows you to enforce a common programming style, and most third-party libraries I came across try to look & feel like the core library.
The other part I like about C# is that it’s incredibly focused on usability. Over the years, it has seen many iterations (we’re at C# 10 these days!) and in my opinion the designers did an incredible job evolving the language without dramatically increasing the complexity. Writing C# code always feels “obvious” to me, and features I’ve seen across various languages (pattern matching, lambdas, generics) are all available in C# in a way that makes it look like they were an integral part of C# from the start.
For me, C# has been one of those languages to use when a scripting language is getting too slow. Need a quick command line tool you want to run on Windows and Linux? C# is a fantastic way to get something up and running quickly, and usually the performance is good enough. Especially now with single-file deployment, first-class Linux support, and an open source runtime, I’ve been using C# quite a bit in recent years.