invio / Invio.Immutable

C# Library used to ease immutable class creation and data management
MIT License
2 stars 0 forks source link

Add [ImmutableSetterConstructor] to distinguish which constructor is used by immutable setters #21

Closed carusology closed 7 years ago

carusology commented 7 years ago

Background

The way setters work with ImmutableBase<TImmutable> works is pretty simple. Every time a value is to be changed for a given property, the code takes that value along with all of the other current values for all of the other properties, passes it to the class's constructor and returns the new object. However, we currently assume there is only one constructor. If you want to have several constructors, ImmutableBase<TImmutable> will need a hint as to which constructor is supposed to be called to create the new version of the caller's data. This can be especially useful if you want consumers of your immutable object to only be able to set specific values when initialing hydrating objects of this type.

Tasks