File tree 4 files changed +36
-2
lines changed
4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ public class QuantityParser
34
34
private readonly UnitAbbreviationsCache _unitAbbreviationsCache ;
35
35
private readonly UnitParser _unitParser ;
36
36
37
+ /// <summary>
38
+ /// The default singleton instance for parsing quantities.
39
+ /// </summary>
40
+ /// <remarks>
41
+ /// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.QuantityParser"/>.
42
+ /// </remarks>
43
+ public static QuantityParser Default => UnitsNetSetup . Default . QuantityParser ;
44
+
37
45
/// <summary>
38
46
/// Creates an instance of <see cref="QuantityParser"/>, optionally specifying an <see cref="UnitAbbreviationsCache"/>
39
47
/// with unit abbreviations to use when parsing.
Original file line number Diff line number Diff line change @@ -31,6 +31,15 @@ public sealed class UnitAbbreviationsCache
31
31
/// </example>
32
32
internal static readonly CultureInfo FallbackCulture = CultureInfo . InvariantCulture ;
33
33
34
+ /// <summary>
35
+ /// The default singleton instance with the default configured unit abbreviations, used for ToString() and parsing of quantities and units.
36
+ /// </summary>
37
+ /// <remarks>
38
+ /// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitAbbreviations"/>.<br />
39
+ /// You can add custom unit abbreviations at runtime, and this will affect all usages globally in the application.
40
+ /// </remarks>
41
+ public static UnitAbbreviationsCache Default => UnitsNetSetup . Default . UnitAbbreviations ;
42
+
34
43
private QuantityInfoLookup QuantityInfoLookup { get ; }
35
44
36
45
/// <summary>
Original file line number Diff line number Diff line change @@ -13,13 +13,21 @@ namespace UnitsNet
13
13
{
14
14
/// <summary>
15
15
/// Parses units given a unit abbreviations cache.
16
- /// A static instance <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup. Default"/>.<see cref="UnitsNetSetup.UnitParser"/> is used internally
17
- /// to parse quantities and units using the default abbreviations cache for all units and abbreviations defined in the library.
16
+ /// The static instance <see cref="Default"/> is used internally to parse quantities and units using the
17
+ /// default abbreviations cache for all units and abbreviations defined in the library.
18
18
/// </summary>
19
19
public sealed class UnitParser
20
20
{
21
21
private readonly UnitAbbreviationsCache _unitAbbreviationsCache ;
22
22
23
+ /// <summary>
24
+ /// The default singleton instance for parsing units from the default configured unit abbreviations.
25
+ /// </summary>
26
+ /// <remarks>
27
+ /// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitParser"/>.
28
+ /// </remarks>
29
+ public static UnitParser Default => UnitsNetSetup . Default . UnitParser ;
30
+
23
31
/// <summary>
24
32
/// Create a parser using the given unit abbreviations cache.
25
33
/// </summary>
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ public delegate TQuantity ConversionFunction<TQuantity>(TQuantity inputValue)
34
34
/// </summary>
35
35
public sealed class UnitConverter
36
36
{
37
+ /// <summary>
38
+ /// The default singleton instance for converting values from one unit to another.<br />
39
+ /// Modify this to add/remove conversion functions at runtime, such as adding your own third-party units and quantities to convert between.
40
+ /// </summary>
41
+ /// <remarks>
42
+ /// Convenience shortcut for <see cref="UnitsNetSetup"/>.<see cref="UnitsNetSetup.Default"/>.<see cref="UnitsNetSetup.UnitConverter"/>.
43
+ /// </remarks>
44
+ public static UnitConverter Default => UnitsNetSetup . Default . UnitConverter ;
45
+
37
46
/// <summary>
38
47
/// Creates a new <see cref="UnitConverter"/> instance.
39
48
/// </summary>
You can’t perform that action at this time.
0 commit comments