Skip to content

v1.5.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@dtanglr dtanglr released this 14 Jul 22:59

Added support for source generating Primitively types that encapsulate decimal, double and float (single) numeric values. For example: -

[Double(2, Minimum = -273.15d)]
public partial record struct Celsius : ITemperature<Celsius>
{
    public static Celsius AbsoluteZero => new(-273.15d);

    public static Celsius WaterMeltingPoint => new(0d);

    public static Celsius WaterBoilingPoint => new(99.9839d);

    public static explicit operator Kelvin(Celsius value) => new(value + 273.15d);
    public static explicit operator Fahrenheit(Celsius value) => new((value * (9d / 5d)) + 32d);
    public static explicit operator Rankine(Celsius value) => new((value + 273.15d) * (9d / 5d));
}