This repo goes with my blog posts that relate to specific versions of C# and versions of .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.
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.
- 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)
- None
- 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)