You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -119,14 +119,29 @@ Unfortunately there is no built-in way to avoid this, either you need to ensure
119
119
Example:
120
120
`Length.Parse("1 pt")` throws `AmbiguousUnitParseException` with message `Cannot parse "pt" since it could be either of these: DtpPoint, PrinterPoint`.
121
121
122
-
### Dynamically Parsing Quantities and Units
122
+
### Dynamically Parsing and Converting Quantities
123
123
Sometimes you need to work with quantities and units at runtime, such as parsing user input.
124
124
There are three classes to help with this:
125
+
-[UnitParser]() for parsing unit abbreviation strings like `cm` to `LengthUnit.Centimeter`
126
+
-[UnitAbbreviationsCache]() for looking up unit abbreviations like `cm` given type `LengthUnit` and value `1` (`Centimeter`)
127
+
-[UnitConverter]() for converting values given a quantity name `Length`, a value `1` and from/to unit names `Centimeter` and `Meter`
125
128
126
129
```c#
130
+
// This type was perhaps selected by the user in GUI from a list of units
131
+
TypelengthUnitType=typeof(LengthUnit); // Selected by user in GUI from a list of units
0 commit comments