Advent 2021: C#
This blog is part of the 24 posts long series "Advent 2021":
- Advent 2021: Intro (December 01, 2021)
- Advent 2021: C++ (December 02, 2021)
- Advent 2021: C# (December 03, 2021)
- Advent 2021: Python (December 04, 2021)
- Advent 2021: Go (December 05, 2021)
- Advent 2021: TypeScript (December 06, 2021)
- Advent 2021: CMake (December 07, 2021)
- Advent 2021: Django (December 08, 2021)
- Advent 2021: Angular (December 09, 2021)
- Advent 2021: Flask (December 10, 2021)
- Advent 2021: gRPC (December 11, 2021)
- Advent 2021: GraphQL (December 12, 2021)
- Advent 2021: XML & JSON (December 13, 2021)
- Advent 2021: Matplotlib, Pandas & Numpy (December 14, 2021)
- Advent 2021: Linux (December 15, 2021)
- Advent 2021: Ansible (December 16, 2021)
- Advent 2021: SQLite (December 17, 2021)
- Advent 2021: Catch2 (December 18, 2021)
- Advent 2021: Zstandard (December 19, 2021)
- Advent 2021: ZFS (December 20, 2021)
- Advent 2021: Thunderbird (December 21, 2021)
- Advent 2021: Visual Studio Code (December 22, 2021)
- Advent 2021: Blender (December 23, 2021)
- Advent 2021: Open source (December 24, 2021)
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.