|
|
|
|
|
by louthy
338 days ago
|
|
Slightly confused. My suggestion was to run the initialisers after the new object has been constructed (cloned+modified). The semantics are the same as you describe even if the underlying implementation is different. What am I missing? |
|
Internal initializers are run as part of the constructor, before any user code. External initializers are run after the constructor, on the constructed object.
For instance:
`c.P` has the value 3.In your example:
The “PostCloneInitializers” you’re running are the field initializers, so the order is backwards. You’re overwriting the value of the external initializers with the internal initializers.