Closed Type Hierarchies with records … NOT! Posted by By sven.huebner.it February 23, 2022Posted inGeneral Development1 Comment TL;DR: You cannot create closed type hierarchies with record types because of the generated protected copy constructor.
Recap: One Year Using C# 9 with .NET Framework Posted by By sven.huebner.it February 12, 2022Posted inGeneral Development You can use C# 9 language features with .NET Framework or netstandard. After more than a year, I can recommend it.
Be more productive with different keystrokes: Explicit interface implementation Posted by By sven.huebner.it January 8, 2022Posted inGeneral Development Implement interfaces explicitly to convey intent, get more help from the compiler and maybe type less.
Be more productive with more keystrokes: seal all the things Posted by By sven.huebner.it November 20, 2021Posted inGeneral Development Declare your classes (and records!) sealed by default.
Be more productive with fewer keystrokes: Access modifiers Posted by By sven.huebner.it November 10, 2021Posted inGeneral Development1 Comment Only declare access modifiers if you do not want the default. This makes the code much more readable and succinct.
Creating POCOs from XSD with a Source Generator Posted by By sven.huebner.it August 8, 2021Posted inGeneral Development How to write a source generator for generating POCOs from XSD files.
Domain Primitives III: easily creating domain-primitive-based data structures from raw data Posted by By sven.huebner.it May 30, 2021Posted inGeneral Development Only a couple dozen lines of helper code enable easy construction of validated data structures out of raw data as well as proper error tracking.
Returning Auto-Unregistering Objects From An Instance-Counting Factory Posted by By sven.huebner.it January 23, 2021Posted inGeneral Development Automatically unregister a disposed instance at the factory by using a wrapper around the instance that executes a factory callback on being disposed.
Domain Primitives II: forcing developers to deal with error cases Posted by By sven.huebner.it December 11, 2020Posted inGeneral Development Using a static method with a Result return type for creating domain primitives forces developers to deal with error cases.
Gotcha with C# 9 Record inheritance and ToString() Posted by By sven.huebner.it November 20, 2020Posted inGeneral Development1 Comment On record types, ToString() and other compiler-synthesized methods cannot be overridden up the inheritance hierarchy in parent records, but must be overridden in the concrete record.