File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
CodeGen/Generators/UnitsNetGen Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,6 @@ internal class QuantityGenerator : GeneratorBase
17
17
private readonly string _valueType ;
18
18
private readonly Unit _baseUnit ;
19
19
20
- private readonly string [ ] _decimalTypes = { "BitRate" , "Information" , "Power" } ;
21
-
22
20
public QuantityGenerator ( Quantity quantity )
23
21
{
24
22
_quantity = quantity ?? throw new ArgumentNullException ( nameof ( quantity ) ) ;
@@ -794,8 +792,8 @@ private void GenerateRelationalOperators()
794
792
rightPart = "value" ;
795
793
}
796
794
797
- var leftCast = _decimalTypes . Contains ( relation . LeftQuantity . Name ) ? "(double)" : "" ;
798
- var rightCast = _decimalTypes . Contains ( relation . RightQuantity . Name ) ? "(double)" : "" ;
795
+ var leftCast = relation . LeftQuantity . ValueType is "decimal" ? "(double)" : string . Empty ;
796
+ var rightCast = relation . RightQuantity . ValueType is "decimal" ? "(double)" : string . Empty ;
799
797
800
798
var expression = $ "{ leftCast } { leftPart } { relation . Operator } { rightCast } { rightPart } ";
801
799
You can’t perform that action at this time.
0 commit comments