WalkerCodeRanger/semver

Replace Change() method with With...() and Without...() methods

WalkerCodeRanger opened this issue · 0 comments

The Change(...) method name implies that it will mutate the version object. The convention for naming methods that produce a modified copy seems to be With...(). Indeed C# 9 is adding a with keyword with similar functionality.

We should deprecate the Change(...) method and replace it with a new API based around With...() and possibly Without...() methods. It still may make sense to have a With(.....) method that uses named arguments similar to the current change method. The advantage of such a method is that it lets you change multiple things at once without producing intermediate objects. However, the disadvantage is that it only accepts prerelease and metadata in a single format, namely a string that must be parsed into individual identifiers.