@@ -64,9 +64,11 @@ public QuantityInfo(QuantityType quantityType, [NotNull] Enum[] units, [NotNull]
64
64
Name = quantityType . ToString ( ) ;
65
65
QuantityType = quantityType ;
66
66
UnitType = UnitEnumTypes . First ( t => t . Name == $ "{ quantityType } Unit") ;
67
- UnitNames = units . Select ( u => u . ToString ( ) ) . ToArray ( ) ;
67
+ UnitInfos = units . Select ( unit => new UnitInfo ( unit ) ) . ToArray ( ) ;
68
+ UnitNames = UnitInfos . Select ( unitInfo => unitInfo . Name ) . ToArray ( ) ;
68
69
Units = units ;
69
- BaseUnit = baseUnit ;
70
+ BaseUnitInfo = new UnitInfo ( baseUnit ) ;
71
+ BaseUnit = BaseUnitInfo . Value ;
70
72
Zero = zero ;
71
73
ValueType = zero . GetType ( ) ;
72
74
BaseDimensions = baseDimensions ;
@@ -82,20 +84,27 @@ public QuantityInfo(QuantityType quantityType, [NotNull] Enum[] units, [NotNull]
82
84
/// </summary>
83
85
public QuantityType QuantityType { get ; }
84
86
87
+ public UnitInfo [ ] UnitInfos { get ; }
88
+
85
89
/// <summary>
86
90
/// All unit names for the quantity, such as ["Centimeter", "Decimeter", "Meter", ...].
87
91
/// </summary>
92
+ [ Obsolete ( "This property is deprecated and will be removed at a future release. Please use the UnitInfos property." ) ]
88
93
public string [ ] UnitNames { get ; }
89
94
90
95
/// <summary>
91
96
/// All unit enum values for the quantity, such as [<see cref="LengthUnit.Centimeter" />,
92
97
/// <see cref="LengthUnit.Decimeter" />, <see cref="LengthUnit.Meter" />, ...].
93
98
/// </summary>
99
+ [ Obsolete ( "This property is deprecated and will be removed at a future release. Please use the UnitInfos property." ) ]
94
100
public Enum [ ] Units { get ; }
95
101
102
+ public UnitInfo BaseUnitInfo { get ; }
103
+
96
104
/// <summary>
97
105
/// The base unit for the quantity, such as <see cref="LengthUnit.Meter" />.
98
106
/// </summary>
107
+ [ Obsolete ( "This property is deprecated and will be removed at a future release. Please use the BaseUnitInfo property." ) ]
99
108
public Enum BaseUnit { get ; }
100
109
101
110
/// <summary>
@@ -134,13 +143,24 @@ public QuantityInfo(QuantityType quantityType, TUnit[] units, TUnit baseUnit, IQ
134
143
: base ( quantityType , units . Cast < Enum > ( ) . ToArray ( ) , baseUnit , zero , baseDimensions )
135
144
{
136
145
Zero = zero ;
146
+ UnitInfos = units . Select ( unit => new UnitInfo < TUnit > ( unit ) ) . ToArray ( ) ;
137
147
Units = units ;
138
- BaseUnit = baseUnit ;
148
+ BaseUnitInfo = new UnitInfo < TUnit > ( baseUnit ) ;
149
+ BaseUnit = BaseUnitInfo . Value ;
139
150
}
140
151
152
+ /// <inheritdoc cref="QuantityInfo.UnitInfos" />
153
+ public new UnitInfo < TUnit > [ ] UnitInfos { get ; }
154
+
141
155
/// <inheritdoc cref="QuantityInfo.Units" />
156
+ [ Obsolete ( "This property is deprecated and will be removed at a future release. Please use the UnitInfos property." ) ]
142
157
public new TUnit [ ] Units { get ; }
143
158
159
+ /// <inheritdoc cref="QuantityInfo.BaseUnitInfo" />
160
+ public new UnitInfo < TUnit > BaseUnitInfo { get ; }
161
+
162
+ /// <inheritdoc cref="QuantityInfo.BaseUnit" />
163
+ [ Obsolete ( "This property is deprecated and will be removed at a future release. Please use the BaseUnitInfo property." ) ]
144
164
public new TUnit BaseUnit { get ; }
145
165
146
166
/// <inheritdoc cref="QuantityInfo.Zero" />
0 commit comments