Using private set doesn't mean the property can only be set via the constructor. It can be set from anywhere inside the instance. This is still a mutable property, only you now have full control over its set calls:
If you want an immutable property, you can use a get-only property (meaning it has to be initialized either directly or from a constructor) or a get/init property (so it can also be initialized from object initialization:
Using
private setdoesn't mean the property can only be set via the constructor. It can be set from anywhere inside the instance. This is still a mutable property, only you now have full control over its set calls:If you want an immutable property, you can use a get-only property (meaning it has to be initialized either directly or from a constructor) or a get/init property (so it can also be initialized from object initialization: