The code here goes with my blog posts relate to specific versions of C# and .NET, which are very closely related and usually updated at the same time (see here and here). I sometimes upload code to separate repos (like for WinForms and misc topics), or to Gist or JsFiddle for shorter snippets.
- What's new in C# | Microsoft Learn
- What's new in .NET | Microsoft Learn
- The relationship between C# language features and library types | Microsoft Learn
- Features Added in C# Language Versions · dotnet/csharplang
- C# programming language versions - Wikipedia
- .NET and .NET Core Support Policy
The list below has links to each blog post and the relevant code, separated by version of language/framework. Links with a †
next to them are in a separate repo, most likely Surviving WinForms, which applies concepts specifically to the WinForms framework.
- Using CountBy and AggregateBy in LINQ (blog post, source code)
- Primary Constructors in Classes and Structs (blog post, source code)
- Time Abstraction
- Part 1 - How to use TimeProvider and FakeTimeProvider (blog post, source code)
- Part 2 - How to use TimeProvider and FakeTimeProvider with timers (blog post, source code)
- Generic Math Support series (source code)
- Generic Attributes (blog post, source code)
- List Patterns (blog post, source code)
- Raw String Literals (blog post, source code)
- MinBy and MaxBy in LINQ (blog post, source code)
- Set-based LINQ - ExceptBy, IntersectBy, UnionBy, DistinctBy (blog post, source code)
- Records, Classes and Equality (blog post, source code)
- Switch/Case Pattern Matching (vs if/else) (blog post, source code)
- None
- Local Functions (aka nested methods) (blog post, source code) †
- Tuples and Deconstruction (blog post, source code) †
- Adding deconstructors to your own (and built-in) types in C# (blog post, source code)
- Null-conditional and Null-coalescing operators (blog post, source code) †
- Nameof (blog post, source code) †
- String Interpolation (blog post, source code) †
- None
- Named Arguments (blog post, source code) †
- None
- None
- Attributes (blog post, source code)
- Exceptions (throw vs throw ex) (blog post)
- Implicit vs Explicit Conversion (blog post, source code)
- Singleton vs Scoped vs Transient (blog post, source code)