Although Eric Wastl has been organizing the Advent of Code since 2015. I only discovered it recently when some colleagues invited me to join the 2021 edition.
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.
During the first 25 days of December, the challenges made me (re)discover many possibilities with C#, some that are long available but maybe not that well known.
Solutions
I had a blast (and some frustration 😉) solving the challenges, starting early morning, every day.
Some of the noteworthy concepts I have used:
- Records, both class(C# 9.0) andstruct(C# 10.0) based.
- Converting data (bits to intwith bit shifting,charto decimal using addition or subtraction, etc.).
- Efficiently read and slice strings, arrays, and lists using IndexandRange(C# 8.0).
- Work with Stack<T>(.NET Framework 2.0),SortedSet<T>(.NET Framework 4.0), andHashSet<T>(.NET Framework 4.7.2).
- Using initonly setters,withexpressions and target typednewexpressions (all C#9.0).
- Many, many more…
I have put all my code and descriptions in my AdventOfCode2021 repo on GitHub.
Maybe this also inspires you to discover a new feature you were not aware of yet!