invio / Invio.Immutable

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

Add SetPropertyValuesImpl() to set multiple values from one invocation #43

Closed carusology closed 6 years ago

carusology commented 6 years ago

Closes #41

I ran into situations where I wanted to set multiple properties simultaneously, notably when I wanted to update a range that had argument style validation in the constructor. This allows that case. Expect more of stuff like this:

public MyImmutable SetRange(int low, int high) {
    return this.SetPropertyValuesImpl(
        ImmutableDictionary<string, object>
            .Empty
            .Add(nameof(MyImmutable.Low), low)
            .Add(nameof(MyImmutable.High), high)
    );
}
coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 9f74c98da2bf24244d6b6142150f734fbf902c97 on 41-set-property-values into 3d71e73cea2760f772bb7306799dd7e0b7d07780 on master.

carusology commented 6 years ago

This fixes some unreported issues with case insensitivity on the previous single-property setter as well. Since we haven't released since I broke it, it isn't worth writing up an issue.