@@ -43,7 +43,7 @@ public struct {_quantity.Name}
43
43
/// <summary>
44
44
/// The numeric value this quantity was constructed with.
45
45
/// </summary>
46
- private readonly { _quantity . ValueType } _value;
46
+ private readonly double _value;
47
47
48
48
/// <summary>
49
49
/// The unit this quantity was constructed with.
@@ -53,7 +53,7 @@ public struct {_quantity.Name}
53
53
/// <summary>
54
54
/// The numeric value this quantity was constructed with.
55
55
/// </summary>
56
- public { _quantity . ValueType } Value => _value;
56
+ public double Value => _value;
57
57
58
58
/// <inheritdoc />
59
59
public { _unitEnumName } Unit => _unit;
@@ -66,7 +66,7 @@ public struct {_quantity.Name}
66
66
/// <param name=""value"">The numeric value to construct this quantity with.</param>
67
67
/// <param name=""unit"">The unit representation to construct this quantity with.</param>
68
68
/// <exception cref=""ArgumentException"">If value is NaN or Infinity.</exception>
69
- public { _quantity . Name } ({ _quantity . ValueType } value, { _unitEnumName } unit)
69
+ public { _quantity . Name } (double value, { _unitEnumName } unit)
70
70
{{
71
71
_value = value;
72
72
_unit = unit;
@@ -79,29 +79,14 @@ public struct {_quantity.Name}
79
79
80
80
/// <summary>
81
81
/// Represents the largest possible value of { _quantity . Name } .
82
- /// </summary>" ) ;
83
-
84
- // Non decimal
85
- Writer . WLCondition ( _quantity . ValueType != "decimal" , $@ "
86
- public static { _quantity . Name } MaxValue {{ get; }} = new { _quantity . Name } ({ _quantity . ValueType } .MaxValue, BaseUnit);
87
-
88
- /// <summary>
89
- /// Represents the smallest possible value of { _quantity . Name } .
90
82
/// </summary>
91
- public static { _quantity . Name } MinValue {{ get; }} = new { _quantity . Name } ({ _quantity . ValueType } .MinValue, BaseUnit);
92
- " ) ;
93
-
94
- // Decimal MaxValue = 79228162514264337593543950335M
95
- Writer . WLCondition ( _quantity . ValueType == "decimal" , $@ "
96
- public static { _quantity . Name } MaxValue {{ get; }} = new { _quantity . Name } (79228162514264337593543950335M, BaseUnit);
83
+ public static { _quantity . Name } MaxValue {{ get; }} = new { _quantity . Name } (double.MaxValue, BaseUnit);
97
84
98
85
/// <summary>
99
86
/// Represents the smallest possible value of { _quantity . Name } .
100
87
/// </summary>
101
- public static { _quantity . Name } MinValue {{ get; }} = new { _quantity . Name } (-79228162514264337593543950335M, BaseUnit);
102
- " ) ;
88
+ public static { _quantity . Name } MinValue {{ get; }} = new { _quantity . Name } (double.MinValue, BaseUnit);
103
89
104
- Writer . WL ( $@ "
105
90
/// <summary>
106
91
/// Gets an instance of this quantity with a value of 0 in the base unit Second.
107
92
/// </summary>
@@ -134,7 +119,7 @@ private void GenerateConversionProperties()
134
119
/// </summary>" ) ;
135
120
Writer . WLIfText ( 2 , GetObsoleteAttributeOrNull ( unit ) ) ;
136
121
Writer . WL ( $@ "
137
- public { _quantity . ValueType } { unit . PluralName } => As({ _unitEnumName } .{ unit . SingularName } );
122
+ public double { unit . PluralName } => As({ _unitEnumName } .{ unit . SingularName } );
138
123
" ) ;
139
124
}
140
125
@@ -161,7 +146,7 @@ private void GenerateStaticFactoryMethods()
161
146
/// <exception cref=""ArgumentException"">If value is NaN or Infinity.</exception>" ) ;
162
147
Writer . WLIfText ( 2 , GetObsoleteAttributeOrNull ( unit ) ) ;
163
148
Writer . WL ( $@ "
164
- public static { _quantity . Name } From{ unit . PluralName } ({ _quantity . ValueType } { valueParamName } ) => new { _quantity . Name } ({ valueParamName } , { _unitEnumName } .{ unit . SingularName } );
149
+ public static { _quantity . Name } From{ unit . PluralName } (double { valueParamName } ) => new { _quantity . Name } ({ valueParamName } , { _unitEnumName } .{ unit . SingularName } );
165
150
" ) ;
166
151
}
167
152
@@ -172,7 +157,7 @@ private void GenerateStaticFactoryMethods()
172
157
/// <param name=""value"">Value to convert from.</param>
173
158
/// <param name=""fromUnit"">Unit to convert from.</param>
174
159
/// <returns>{ _quantity . Name } unit value.</returns>
175
- public static { _quantity . Name } From({ _quantity . ValueType } value, { _unitEnumName } fromUnit)
160
+ public static { _quantity . Name } From(double value, { _unitEnumName } fromUnit)
176
161
{{
177
162
return new { _quantity . Name } (value, fromUnit);
178
163
}}
@@ -190,7 +175,7 @@ private void GenerateConversionMethods()
190
175
/// Convert to the unit representation <paramref name=""unit"" />.
191
176
/// </summary>
192
177
/// <returns>Value converted to the specified unit.</returns>
193
- public { _quantity . ValueType } As({ _unitEnumName } unit) => GetValueAs(unit);
178
+ public double As({ _unitEnumName } unit) => GetValueAs(unit);
194
179
195
180
/// <summary>
196
181
/// Converts this { _quantity . Name } to another { _quantity . Name } with the unit representation <paramref name=""unit"" />.
@@ -207,7 +192,7 @@ private void GenerateConversionMethods()
207
192
/// This is typically the first step in converting from one unit to another.
208
193
/// </summary>
209
194
/// <returns>The value in the base unit representation.</returns>
210
- private { _quantity . ValueType } GetValueInBaseUnit()
195
+ private double GetValueInBaseUnit()
211
196
{{
212
197
return Unit switch
213
198
{{" ) ;
@@ -223,7 +208,7 @@ private void GenerateConversionMethods()
223
208
}};
224
209
}}
225
210
226
- private { _quantity . ValueType } GetValueAs({ _unitEnumName } unit)
211
+ private double GetValueAs({ _unitEnumName } unit)
227
212
{{
228
213
if (Unit == unit)
229
214
return _value;
0 commit comments