@@ -30,12 +30,11 @@ See [Upgrading from 3.x to 4.x](https://github.com/angularsen/UnitsNet/wiki/Upgr
30
30
* [ Operator overloads] ( #operator-overloads ) for arithmetic on quantities
31
31
* [ Parse and ToString()] ( #culture ) supports cultures and localization
32
32
* [ Dynamically parse and convert] ( #dynamic-parsing ) quantities and units
33
- * [ Custom units] ( #custom-units )
33
+ * [ Extensible with custom units] ( #custom-units )
34
34
* [ Example: Creating a unit converter app] ( #example-app )
35
35
* [ Example: WPF app using IValueConverter to parse quantities from input] ( #example-wpf-app-using-ivalueconverter-to-parse-quantities-from-input )
36
36
* [ Precision and accuracy] ( #precision )
37
37
* [ Serialize with JSON.NET] ( #serialization )
38
- * Extensible with [ custom units] ( https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units )
39
38
* [ Contribute] ( #contribute ) if you are missing some units
40
39
* [ Continuous integration] ( #ci ) posts status reports to pull requests and commits
41
40
* [ Who are using this?] ( #who-are-using )
@@ -238,15 +237,15 @@ Read more at [Extending-with-Custom-Units](https://github.com/angularsen/UnitsNe
238
237
UnitAbbreviationsCache .Default .MapUnitToDefaultAbbreviation (HowMuchUnit .Some , " sm" );
239
238
UnitAbbreviationsCache .Default .GetDefaultAbbreviation (HowMuchUnit .Some ); // "sm"
240
239
UnitParser .Default .Parse <HowMuchUnit >(" sm" ); // HowMuchUnit.Some
240
+ ```
241
241
242
+ #### Convert between units of custom quantity
243
+ ```c #
242
244
var unitConverter = UnitConverter .Default ;
243
245
unitConverter .SetConversionFunction <HowMuch >(HowMuchUnit .Lots , HowMuchUnit .Some , x => new HowMuch (x .Value * 2 , HowMuchUnit .Some ));
244
246
unitConverter .SetConversionFunction <HowMuch >(HowMuchUnit .Tons , HowMuchUnit .Lots , x => new HowMuch (x .Value * 10 , HowMuchUnit .Lots ));
245
247
unitConverter .SetConversionFunction <HowMuch >(HowMuchUnit .Tons , HowMuchUnit .Some , x => new HowMuch (x .Value * 20 , HowMuchUnit .Some ));
246
- ```
247
248
248
- #### Convert between units of custom quantity
249
- ```c #
250
249
var from = new HowMuch (10 , HowMuchUnit .Tons );
251
250
IQuantity Convert (HowMuchUnit toUnit ) => unitConverter .GetConversionFunction <HowMuch >(from .Unit , toUnit )(from );
252
251
0 commit comments