2 ms·
There’s also (in C#) init, readonly, required, and quite a few more keywords and techniques, governing property mutability, private class field mutability, and
by arwhatever 2y ago
There’s also (in C#) init, readonly, required, and quite a few more keywords and techniques, governing property mutability, private class field mutability, and so on.
And then none of those techniques work as well as manually typing out a required constructor which hard-enforces that required data be priced upon object initialization.
I understand required vs optional immediately a la Rust and F# (ignoring for a moment F#’s null awareness) but as a 17 year C# dev, I’ve had to create an initialization chart to keep straight all of the C# techniques.