4 ms·
readonly means the property is immutable. It can't be changed after construction, period. "private set" suggests it can be changed at any time, but only priva
by DavidWoof 11y ago
readonly means the property is immutable. It can't be changed after construction, period. "private set" suggests it can be changed at any time, but only privately.
Like I said, it's a small item, but if immutability is a primary concern to you during class design, then typing that "private set" constantly (or alternately, using a backing field) annoys you just a little bit multiple times a day. You're acutely aware of it and its workarounds.
Most devs, even most "advanced" devs, don't think about immutability that much. I would never dream of using this as some kind of hiring filter when hiring devs, it's too obscure. But if I'm on the other side of the interview chair, I find it useful to know if your top devs, the people you rely on to evaluate others, care about things like that.
OTOH, in practice, I think the question turned out to be not nearly as useful as some of the testing questions I've asked in the past.