Skip to main content

Posts

Featured

Attendance Required

One easily overlooked feature of C# is the required keyword for properties. Introduced in C# v11.0 with .NET v7.0, its purpose is to make it easier to write defensive code that fails at compile-time if it’s misused, rather than at run-time with an obscure exception. That is certainly a worthy goal, because compiler errors are easier and less embarrassing to fix than an unexpected failure in a demo to a customer or in production. However, there is more to required than meets the unaided eye, and it’s not the magic potion that it might at first appear to be.

Latest Posts