Commit 1d644f8
💥Remove decimal support (#1359)
### Changes
- Remove `QuantityValue`, replaced with `double`
- Remove `TValueType` from interfaces
- Remove `IQuantity<TUnitType, out TValueType>`
- Remove `IValueQuantity<out TValueType>`
- Change `IQuantity<TSelf, TUnitType, out TValueType>` to
`IQuantity<TSelf, TUnitType>`
- Change `IArithmeticQuantity<TSelf, TUnitType, TValueType>` to
`IArithmeticQuantity<TSelf, TUnitType>`
### Changes to UnitsNet.Serialiation.JsonNet
- Deserializing previously serialized JSON for decimal quantities
`Information`, `BitRate` and `Power` still work, but it now reads just
`double Value` property and ignores `string ValueString` and `string
ValueType` properties. This may lose precision compared to preserving
the full `decimal` value, but `decimal` is no longer supported in v6.
### Background
In #1195 @angularsen says:
> If we change all 3 quantities to double, we have the potential to
clean up a LOT of QuantityValue complexity.
This made me wonder how deep that complexity goes so I decided to
experiment, and this is the result.
I must say some of these changes make me a bit sad. A lot of work and
some very clever thinking went into supporting multiple numerical types,
and I want to acknowledge that. 🙇
Also, I took it as far as possible but that might not be the best
outcome, for example we might want to keep deserialization support. This
just demonstrates a possible direction we could go in.
---------
Co-authored-by: Andreas Gullberg Larsen <[email protected]>1 parent aeb0cd7 commit 1d644f8
File tree
280 files changed
+3761
-8973
lines changed- CodeGen
- Generators
- NanoFrameworkGen
- UnitsNetGen
- JsonTypes
- UnitsNet.NumberExtensions/GeneratedCode
- UnitsNet.Serialization.JsonNet.Tests
- UnitsNet.Serialization.JsonNet
- UnitsNet.Tests
- CustomCode
- CustomQuantities
- UnitsNet
- CustomCode
- GeneratedCode
- Quantities
- GenericMath
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
280 files changed
+3761
-8973
lines changedLines changed: 11 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 82 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 83 | + | |
97 | 84 | | |
98 | 85 | | |
99 | 86 | | |
100 | 87 | | |
101 | | - | |
102 | | - | |
| 88 | + | |
103 | 89 | | |
104 | | - | |
105 | 90 | | |
106 | 91 | | |
107 | 92 | | |
| |||
134 | 119 | | |
135 | 120 | | |
136 | 121 | | |
137 | | - | |
| 122 | + | |
138 | 123 | | |
139 | 124 | | |
140 | 125 | | |
| |||
161 | 146 | | |
162 | 147 | | |
163 | 148 | | |
164 | | - | |
| 149 | + | |
165 | 150 | | |
166 | 151 | | |
167 | 152 | | |
| |||
172 | 157 | | |
173 | 158 | | |
174 | 159 | | |
175 | | - | |
| 160 | + | |
176 | 161 | | |
177 | 162 | | |
178 | 163 | | |
| |||
190 | 175 | | |
191 | 176 | | |
192 | 177 | | |
193 | | - | |
| 178 | + | |
194 | 179 | | |
195 | 180 | | |
196 | 181 | | |
| |||
207 | 192 | | |
208 | 193 | | |
209 | 194 | | |
210 | | - | |
| 195 | + | |
211 | 196 | | |
212 | 197 | | |
213 | 198 | | |
| |||
223 | 208 | | |
224 | 209 | | |
225 | 210 | | |
226 | | - | |
| 211 | + | |
227 | 212 | | |
228 | 213 | | |
229 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 93 | | |
108 | 94 | | |
109 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 65 | | |
81 | 66 | | |
82 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
0 commit comments