Skip to content

Commit d4b9425

Browse files
committed
Fix codegen script
1 parent 73477e0 commit d4b9425

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,12 @@ function GenerateArithmeticOperators([GeneratorArgs]$genArgs)
750750
751751
public static $quantityName operator +($quantityName left, $quantityName right)
752752
{
753-
return new $quantityName(left.Value + right.AsBaseNumericType(left.Unit), left.Unit);
753+
return From(left.AsBaseUnit() + right.AsBaseUnit(), BaseUnit).ToUnit(left.Unit);
754754
}
755755
756756
public static $quantityName operator -($quantityName left, $quantityName right)
757757
{
758-
return new $quantityName(left.Value - right.AsBaseNumericType(left.Unit), left.Unit);
758+
return From(left.AsBaseUnit() - right.AsBaseUnit(), BaseUnit).ToUnit(left.Unit);
759759
}
760760
761761
public static $quantityName operator *($valueType left, $quantityName right)
@@ -812,12 +812,12 @@ function GenerateEqualityAndComparison([GeneratorArgs]$genArgs)
812812
return left.Value > right.AsBaseNumericType(left.Unit);
813813
}
814814
815-
public static bool operator ==($quantityName left, $quantityName right)
815+
public static bool operator ==($quantityName left, $quantityName right)
816816
{
817817
return left.Equals(right);
818818
}
819819
820-
public static bool operator !=($quantityName left, $quantityName right)
820+
public static bool operator !=($quantityName left, $quantityName right)
821821
{
822822
return !(left == right);
823823
}

0 commit comments

Comments
 (0)