News for hackers. Stuff that matters.
Re:It’s strange what people put up with in C# by ddek on Saturday August 15, 2020 @07:10AM (#24168012)
I’m not overly enthusiastic about most of his suggestions. I thin C# has, or is gaining, more appropriate alternatives for all of these.

In C# we don’t like functions with more than a few arguments. If you have 10 fields in your class, a constructor with 10 arguments is not appropriate. Instead we prefer object initialisers, but this requires exposing the ‘set’ method, and allowing mutability. This is resolved in C# 9, with init-only properties.

Re:It’s strange what people put up with in C# by walleeee on Saturday August 15, 2020 @07:51PM (#24173490)
> If you have 10 fields in your class, a constructor with 10 arguments is not appropriate. Instead we prefer object initialisers, but this requires exposing the ‘set’ method, and allowing mutability.

Why not have the ctor accept a single options object? At least if initialization is your only reason for allowing mutable props.