Deconstructables + simple parsers singletons + emptiness
- Simple type parsers are exposed via singletons (see i.e. DoubleParser.Instance)
- New type of parsing strategy - Deconstructables. It is enough for type to have constructor and matching Deconstruct - these members will be used to parse/format object automatically i.e. this structure
readonly struct Address
{
public string City { get; }
public int ZipCode { get; }
public Address(string city, int zipCode)
{
City = city;
ZipCode = zipCode;
}
public void Deconstruct(out string city, out int zipCode)
{
city = City;
zipCode = ZipCode;
}
}
will be automatically formatted to "(City;ZipCode)" format and parsed from same format
-
New concept - emptiness vs null parsing. Now transformers can decide what it meas to them when "" string is parsed as opposed to null string
-
TupleHelper - user can now create complex parser that parse tuple-like structures (records etc.) using common logic
-
Transformables - types can register own transformers using TransformerAttribute. Such custom transformers can benefit from simple dependency injections (currently only TransformerStore object) via constructor
DEPRECATED:
One of next minor releases will be the last one where we support FromText(string) convention. It was only a bridge for consumers bound to targets < .NET Standard 2.1. Now we encourage upgrade to FromText(ReadOnlySpan) - especially since all simple type parsers are exposed via singletons (see i.e. DoubleParser.Instance)