Add unary - operator for nullable powers

This commit is contained in:
ig 2023-08-25 17:11:41 +02:00
parent 2ace3fad51
commit f8b1d70f79
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,6 @@ public sealed class ActivePower : AcPower
public static implicit operator ActivePower(Double d) => new ActivePower(d);
public static implicit operator Double(ActivePower d) => d.Value;
public static ActivePower operator -(ActivePower d) => -d.Value;
public static ActivePower? operator -(ActivePower? d) => -d?.Value;
}

View File

@ -10,5 +10,7 @@ public sealed class ReactivePower : AcPower
public static implicit operator ReactivePower(Double d) => new ReactivePower(d);
public static implicit operator Double(ReactivePower d) => d.Value;
public static ReactivePower? operator -(ReactivePower? d) => -d?.Value;
}