diff --git a/README.md b/README.md
index 7e0d49eaad..3f606ccbf2 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ See [Upgrading from 3.x to 4.x](https://github.com/angularsen/UnitsNet/wiki/Upgr
* [Statically typed quantities and units](#static-typing) to avoid mistakes and communicate intent
* [Operator overloads](#operator-overloads) for arithmetic on quantities
* [Parse and ToString()](#culture) supports cultures and localization
-* [Dynamically parsing and converting](#dynamic-parsing) quantities and units
+* [Dynamically parse and convert](#dynamic-parsing) quantities and units
* [Example: Creating a unit converter app](#example-app)
* [Example: WPF app using IValueConverter to parse quantities from input](#example-wpf-app-using-ivalueconverter-to-parse-quantities-from-input)
* [Precision and accuracy](#precision)
@@ -125,29 +125,105 @@ Unfortunately there is no built-in way to avoid this, either you need to ensure
Example:
`Length.Parse("1 pt")` throws `AmbiguousUnitParseException` with message `Cannot parse "pt" since it could be either of these: DtpPoint, PrinterPoint`.
-### Dynamically Parsing and Converting Quantities
+### Dynamically Parse Quantities and Convert to Units
Sometimes you need to work with quantities and units at runtime, such as parsing user input.
-There are three classes to help with this:
-- [UnitParser](UnitsNet/CustomCode/UnitParser.cs) for parsing unit abbreviation strings like `cm` to `LengthUnit.Centimeter`
-- [UnitAbbreviationsCache](UnitsNet/CustomCode/UnitAbbreviationsCache.cs) for looking up unit abbreviations like `cm` given type `LengthUnit` and value `1` (`Centimeter`)
-- [UnitConverter](UnitsNet/UnitConverter.cs) for converting values given a quantity name `Length`, a value `1` and from/to unit names `Centimeter` and `Meter`
+
+There are a handful of classes to help with this:
+
+- [Quantity](UnitsNet/CustomCode/Quantity.cs) for parsing and constructing quantities as well as looking up units, names and quantity information dynamically
+- [UnitConverter](UnitsNet/UnitConverter.cs) for converting values to a different unit, with only strings or enum values
+- [UnitParser](UnitsNet/CustomCode/UnitParser.cs) for parsing unit abbreviation strings, such as `"cm"` to `LengthUnit.Centimeter`
+
+#### Enumerate quantities and units
+`Quantity` is the go-to class for looking up information about quantities at runtime.
+```c#
+string[] Quantity.Names; // ["Length", "Mass", ...]
+QuantityType[] Quantity.Types; // [QuantityType.Length, QuantityType.Mass, ...]
+QuantityInfo[] Quantity.Infos; // Information about all quantities and their units, types, values etc., see more below
+
+QuantityInfo Quantity.GetInfo(QuantityType.Length); // Get information about Length
+```
+
+#### Information about quantity type
+`QuantityInfo` makes it easy to enumerate names, units, types and values for the quantity type.
+This is useful for populating lists of quantities and units for the user to choose.
+
+```c#
+QuantityInfo lengthInfo = Quantity.GetInfo(QuantityType.Length); // You can get it statically here
+lengthInfo = Length.Info; // or statically per quantity
+lengthInfo = Length.Zero.QuantityInfo; // or dynamically from quantity instances
+
+lengthInfo.Name; // "Length"
+lengthInfo.QuantityType; // QuantityType.Length
+lengthInfo.UnitNames; // ["Centimeter", "Meter", ...]
+lengthInfo.Units; // [LengthUnit.Centimeter, LengthUnit.Meter, ...]
+lengthInfo.UnitType; // typeof(LengthUnit)
+lengthInfo.ValueType; // typeof(Length)
+lengthInfo.Zero; // Length.Zero
+```
+
+#### Construct quantity
+All you need is the value and the unit enum value.
+
+```c#
+IQuantity quantity = Quantity.From(3, LengthUnit.Centimeter); // Length
+
+if (Quantity.TryFrom(3, LengthUnit.Centimeter, out IQuantity quantity2))
+{
+}
+```
+#### Parse quantity
+Parse any string to a quantity instance of the given the quantity type.
+
+```c#
+IQuantity quantity = Quantity.Parse(typeof(Length), "3 cm"); // Length
+
+if (Quantity.TryParse(typeof(Length), "3cm", out IQuantity quantity2)
+{
+}
+```
+
+#### Parse unit
+[UnitParser](UnitsNet/CustomCode/UnitParser.cs) parses unit abbreviation strings to unit enum values.
```c#
-// This type was perhaps selected by the user in GUI from a list of units
-Type lengthUnitType = typeof(LengthUnit); // Selected by user in GUI from a list of units
+Enum unit = UnitParser.Default.Parse("cm", typeof(LengthUnit)); // LengthUnit.Centimeter
-// Parse units dynamically
-UnitParser parser = UnitParser.Default;
-int fromUnitValue = (int)parser.Parse("cm", lengthUnitType); // LengthUnit.Centimeter == 1
+if (UnitParser.Default.TryParse("cm", typeof(LengthUnit), out Enum unit2))
+{
+ // Use unit2 as LengthUnit.Centimeter
+}
+```
-// Get unit abbreviations dynamically
-var cache = UnitAbbreviationsCache.Default;
-string fromUnitAbbreviation = cache.GetDefaultAbbreviation(lengthUnitType, 1); // "cm"
+#### Convert quantity to unit - IQuantity and Enum
+Convert any `IQuantity` instance to a different unit by providing a target unit enum value.
+```c#
+// Assume these are passed in at runtime, we don't know their values or type
+Enum userSelectedUnit = LengthUnit.Millimeter;
+IQuantity quantity = Length.FromCentimeters(3);
+
+// Later we convert to a unit
+quantity.ToUnit(userSelectedUnit).Value; // 30
+quantity.ToUnit(userSelectedUnit).Unit; // LengthUnit.Millimeter
+quantity.ToUnit(userSelectedUnit).ToString(); // "30 mm"
+quantity.ToUnit(PressureUnit.Pascal); // Throws exception, not compatible
+quantity.As(userSelectedUnit); // 30
+```
-double centimeters = UnitConverter.ConvertByName(1, "Length", "Meter", "Centimeter"); // 100
+#### Convert quantity to unit - From/To Enums
+Useful when populating lists with unit enum values for the user to choose.
+
+```c#
+UnitConverter.Convert(1, LengthUnit.Centimeter, LengthUnit.Millimeter); // 10 mm
```
-For more examples on dynamic parsing and conversion, see the unit conversion applications below.
+#### Convert quantity to unit - Names or abbreviation strings
+Sometimes you only have strings to work with, that works too!
+
+```c#
+UnitConverter.ConvertByName(1, "Length", "Centimeter", "Millimeter"); // 10 mm
+UnitConverter.ConvertByAbbreviation(1, "Length", "cm", "mm"); // 10 mm
+```
### Example: Creating a dynamic unit converter app
[Source code](https://github.com/angularsen/UnitsNet/tree/master/Samples/UnitConverter.Wpf) for `Samples/UnitConverter.Wpf`
@@ -156,25 +232,37 @@ For more examples on dynamic parsing and conversion, see the unit conversion app

-This example shows how you can create a dynamic unit converter, where the user selects the quantity to convert, such as `Length` or `Mass`, then selects to convert from `Meter` to `Centimeter` and types in a value for how many meters.
+This example shows how you can create a dynamic unit converter, where the user selects the quantity to convert, such as `Temperature`, then selects to convert from `DegreeCelsius` to `DegreeFahrenheit` and types in a numeric value for how many degrees Celsius to convert.
+The quantity list box contains `QuantityType` values such as `QuantityType.Length` and the two unit list boxes contain `Enum` values, such as `LengthUnit.Meter`.
-NOTE: There are still some limitations in the library that requires reflection to enumerate units for quantity and getting the abbreviation for a unit, when we want to dynamically enumerate and convert between units.
+#### Populate quantity selector
+Use `Quantity` to enumerate all quantity type enum values, such as `QuantityType.Length` and `QuantityType.Mass`.
-### Example: Creating a unit converter app with hard coded quantities
+```c#
+this.Quantities = Quantity.Types; // QuantityType[]
+```
-If you can live with hard coding what quantities to convert between, then the following code snippet shows you one way to go about it:
+#### Update unit lists when selecting new quantity
+So user can only choose from/to units compatible with the quantity type.
-```C#
-// Get quantities for populating quantity UI selector
-QuantityType[] quantityTypes = Enum.GetValues(typeof(QuantityType)).Cast().ToArray();
+```c#
+QuantityInfo quantityInfo = Quantity.GetInfo(quantityType);
-// If Length is selected, get length units for populating from/to UI selectors
-LengthUnit[] lengthUnits = Length.Units;
+_units.Clear();
+foreach (Enum unitValue in quantityInfo.Units)
+{
+ _units.Add(unitValue);
+}
+```
+
+#### Update calculation on unit selection changed
+Using `UnitConverter` to convert by unit enum values as given by the list selection `"Length"` and unit names like `"Centimeter"` and `"Meter"`.
-// Perform conversion using input value and selected from/to units
-double inputValue; // Obtain from textbox
-LengthUnit fromUnit, toUnit; // Obtain from ListBox selections
-double resultValue = Length.From(inputValue, fromUnit).As(toUnit);
+```c#
+double convertedValue = UnitConverter.Convert(
+ FromValue, // numeric value
+ SelectedFromUnit.UnitEnumValue, // Enum, such as LengthUnit.Meter
+ SelectedToUnit.UnitEnumValue); // Enum, such as LengthUnit.Centimeter
```
### Example: WPF app using IValueConverter to parse quantities from input
@@ -183,11 +271,8 @@ Src: [Samples/WpfMVVMSample](https://github.com/angularsen/UnitsNet/tree/master/

-
The purpose of this app is to show how to create an `IValueConverter` in order to bind XAML to quantities.
-NOTE: A lot of reflection and complexity were introduced due to not having a base type. See #371 for discussion on adding base types.
-
### Precision and Accuracy
A base unit is chosen for each unit class, represented by a double value (64-bit), and all conversions go via this unit. This means that there will always be a small error in both representing other units than the base unit as well as converting between units.
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/DelegateCommand.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/DelegateCommand.cs
index b45ce23107..7a771fc722 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/DelegateCommand.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/DelegateCommand.cs
@@ -26,6 +26,9 @@ public void Execute(object parameter)
_commandDelegate.Invoke();
}
+ // Is never used
+#pragma warning disable CS0067
public event EventHandler CanExecuteChanged;
+#pragma warning restore CS0067
}
-}
\ No newline at end of file
+}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
index c062f6d460..dcf70b3d4d 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
@@ -27,4 +27,4 @@ public interface IMainWindowVm : INotifyPropertyChanged
decimal ToValue { get; }
ICommand SwapCommand { get; }
}
-}
\ No newline at end of file
+}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
index b97fe92bcb..379acaa380 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
@@ -1,8 +1,8 @@
-using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Windows.Input;
namespace UnitsNet.Samples.UnitConverter.Wpf
@@ -15,13 +15,14 @@ public sealed class MainWindowDesignVm : IMainWindowVm
{
public MainWindowDesignVm()
{
- Quantities = ToReadOnly(Enum.GetValues(typeof(QuantityType)).Cast().Skip(1));
+ Quantities = ToReadOnly(Quantity.Types);
Units = ToReadOnly(Length.Units.Select(u => new UnitListItem(u)));
SelectedQuantity = QuantityType.Length;
SelectedFromUnit = Units[1];
SelectedToUnit = Units[2];
}
+
public ReadOnlyObservableCollection Quantities { get; }
public ReadOnlyObservableCollection Units { get; }
public QuantityType SelectedQuantity { get; set; }
@@ -35,11 +36,14 @@ public MainWindowDesignVm()
public ICommand SwapCommand { get; } = new RoutedCommand();
+ // Is never used
+#pragma warning disable CS0067
public event PropertyChangedEventHandler PropertyChanged;
+#pragma warning restore CS0067
private static ReadOnlyObservableCollection ToReadOnly(IEnumerable items)
{
return new ReadOnlyObservableCollection(new ObservableCollection(items));
}
}
-}
\ No newline at end of file
+}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
index bb4368201a..a8203a22a5 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
@@ -29,7 +29,7 @@ public sealed class MainWindowVm : IMainWindowVm
public MainWindowVm()
{
- Quantities = ToReadOnly(Enum.GetValues(typeof(QuantityType)).Cast().Skip(1));
+ Quantities = ToReadOnly(Quantity.Types);
_units = new ObservableCollection();
Units = new ReadOnlyObservableCollection(_units);
@@ -131,21 +131,25 @@ private void UpdateResult()
{
if (SelectedFromUnit == null || SelectedToUnit == null) return;
- ToValue = Convert.ToDecimal(UnitsNet.UnitConverter.ConvertByName(FromValue,
- SelectedQuantity.ToString(),
- SelectedFromUnit.UnitEnumValue.ToString(),
- SelectedToUnit.UnitEnumValue.ToString()));
+ double convertedValue = UnitsNet.UnitConverter.Convert(FromValue,
+ SelectedFromUnit.UnitEnumValue,
+ SelectedToUnit.UnitEnumValue);
+
+ ToValue = Convert.ToDecimal(convertedValue);
}
- private void OnSelectedQuantity(QuantityType quantity)
+ private void OnSelectedQuantity(QuantityType quantityType)
{
+ QuantityInfo quantityInfo = Quantity.GetInfo(quantityType);
+
_units.Clear();
- IEnumerable unitValues = UnitHelper.GetUnits(quantity);
- foreach (object unitValue in unitValues) _units.Add(new UnitListItem(unitValue));
+ foreach (Enum unitValue in quantityInfo.Units)
+ {
+ _units.Add(new UnitListItem(unitValue));
+ }
- SelectedQuantity = quantity;
- SelectedFromUnit = Units.FirstOrDefault();
- SelectedToUnit = Units.Skip(1).FirstOrDefault() ?? SelectedFromUnit; // Try to pick a different to-unit
+ SelectedFromUnit = _units.FirstOrDefault();
+ SelectedToUnit = _units.Skip(1).FirstOrDefault() ?? SelectedFromUnit; // Try to pick a different to-unit
}
private static ReadOnlyObservableCollection ToReadOnly(IEnumerable items)
@@ -159,4 +163,4 @@ private void OnPropertyChanged([CallerMemberName] string propertyName = null)
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
-}
\ No newline at end of file
+}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
index c8277e5abc..6a7b657f4c 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
@@ -73,7 +73,6 @@
MSBuild:Compile
Designer
-
MSBuild:Compile
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitHelper.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitHelper.cs
deleted file mode 100644
index 73feb754b3..0000000000
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitHelper.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace UnitsNet.Samples.UnitConverter.Wpf
-{
- ///
- /// TODO Move me into the UnitsNet library. This will solve a pain point in generically enumerating units for a quantity.
- ///
- public static class UnitHelper
- {
- ///
- /// Look up and cache all unit enum types once with reflection, such as LengthUnit and MassUnit.
- ///
- private static readonly Type[] UnitEnumTypes =
- Assembly.GetAssembly(typeof(Length)).ExportedTypes.Where(t => t.IsEnum && t.Namespace == "UnitsNet.Units").ToArray();
-
- public static IReadOnlyList GetUnits(QuantityType quantity)
- {
- // Ex: Find unit enum type UnitsNet.Units.LengthUnit from quantity enum name QuantityType.Length
- Type unitEnumType = UnitEnumTypes.First(t => t.FullName == $"UnitsNet.Units.{quantity}Unit");
- return Enum.GetValues(unitEnumType).Cast().Skip(1).ToArray();
- }
- }
-}
\ No newline at end of file
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
index 897361a0b3..555fc3195d 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
@@ -9,10 +9,10 @@ namespace UnitsNet.Samples.UnitConverter.Wpf
///
public sealed class UnitListItem
{
- public UnitListItem(object val)
+ public UnitListItem(Enum val)
{
UnitEnumValue = val;
- UnitEnumValueInt = (int) val;
+ UnitEnumValueInt = Convert.ToInt32(val);
UnitEnumType = val.GetType();
Abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(UnitEnumType, UnitEnumValueInt);
@@ -20,7 +20,7 @@ public UnitListItem(object val)
}
public string Text { get; }
- public object UnitEnumValue { get; }
+ public Enum UnitEnumValue { get; }
public int UnitEnumValueInt { get; }
public Type UnitEnumType { get; }
public string Abbreviation { get; }
diff --git a/Samples/WpfMVVMSample/WpfMVVMSample/Converters/EnumBindingSource.cs b/Samples/WpfMVVMSample/WpfMVVMSample/Converters/EnumBindingSource.cs
index 02d87b7737..db5b223288 100644
--- a/Samples/WpfMVVMSample/WpfMVVMSample/Converters/EnumBindingSource.cs
+++ b/Samples/WpfMVVMSample/WpfMVVMSample/Converters/EnumBindingSource.cs
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Markup;
namespace WpfMVVMSample.Converters
@@ -13,10 +10,10 @@ public class EnumBindingSourceExtension : MarkupExtension
private Type _enumType;
private Type EnumType
{
- get { return this._enumType; }
+ get => _enumType;
set
{
- if (value != this._enumType)
+ if (value != _enumType)
{
if (value != null)
{
@@ -26,27 +23,29 @@ private Type EnumType
throw new ArgumentException("Type must be for an Enum.");
}
- this._enumType = value;
+ _enumType = value;
}
}
}
+ // Instantiated by GUI
+ // ReSharper disable once UnusedMember.Global
public EnumBindingSourceExtension() { }
public EnumBindingSourceExtension(Type enumType)
{
- this.EnumType = enumType;
+ EnumType = enumType;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
- if (this._enumType== null)
+ if (_enumType== null)
throw new InvalidOperationException("The EnumType must be specified.");
- Type actualEnumType = Nullable.GetUnderlyingType(this._enumType) ?? this._enumType;
-
- //omits the first enum element, typically "undefined"
- var enumValues = Enum.GetValues(actualEnumType).Cast().Skip(1);
+ Type actualEnumType = Nullable.GetUnderlyingType(_enumType) ?? _enumType;
+
+ // Omits the first unit enum element, such as LengthUnit.Undefined
+ IEnumerable enumValues = Enum.GetValues(actualEnumType).Cast().Skip(1);
return enumValues;
}
diff --git a/Samples/WpfMVVMSample/WpfMVVMSample/Converters/UnitToStringConverter.cs b/Samples/WpfMVVMSample/WpfMVVMSample/Converters/UnitToStringConverter.cs
index d783152170..e1d5842eaf 100644
--- a/Samples/WpfMVVMSample/WpfMVVMSample/Converters/UnitToStringConverter.cs
+++ b/Samples/WpfMVVMSample/WpfMVVMSample/Converters/UnitToStringConverter.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.Globalization;
+using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -11,10 +12,10 @@
namespace WpfMVVMSample.Converters
{
- public class UnitToStringConverter :MarkupExtension, IValueConverter
+ public class UnitToStringConverter : MarkupExtension, IValueConverter
{
//http://www.thejoyofcode.com/WPF_Quick_Tip_Converters_as_MarkupExtensions.aspx
- private SettingsManager _settings;
+ private readonly SettingsManager _settings;
private static UnitToStringConverter _instance;
public UnitToStringConverter()
@@ -25,62 +26,51 @@ public UnitToStringConverter()
}
}
-
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- var quantityType = value.GetType();
- var unitEnumType = quantityType.GetProperty("BaseUnit").PropertyType;
- var unitEnumValue = _settings.GetDefaultUnit(unitEnumType);
- var significantDigits = _settings.SignificantDigits;
+ if (!(value is IQuantity quantity))
+ throw new ArgumentException("Expected value of type UnitsNet.IQuantity.", nameof(value));
+
+ Enum unitEnumValue = _settings.GetDefaultUnit(quantity.QuantityInfo.UnitType);
+ int significantDigits = _settings.SignificantDigits;
- var quantityInUnit =
- quantityType
- .GetMethod("ToUnit", new[] {unitEnumType})
- .Invoke(value, new[] {unitEnumValue});
+ IQuantity quantityInUnit = quantity.ToUnit(unitEnumValue);
- var result = quantityType
- .GetMethod("ToString", new[] {typeof(IFormatProvider), typeof(int)})
- .Invoke(quantityInUnit, new object[] {null, significantDigits});
+ return quantityInUnit.ToString(null, significantDigits);
- return result;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
- var unitEnumType = targetType.GetProperty("BaseUnit").PropertyType;
- var unitEnumValue = _settings.GetDefaultUnit(unitEnumType);
+ if (!typeof(IQuantity).IsAssignableFrom(targetType))
+ throw new ArgumentException("Expected targetType of type UnitsNet.IQuantity.", nameof(value));
- if ((string)value == "") return 0.0;
-
- double number;
- if (double.TryParse((string)value, out number))
- return ParseDouble(targetType, number, unitEnumType, unitEnumValue);
+ if (value == null ||
+ !(value is string valueString) ||
+ string.IsNullOrWhiteSpace(valueString))
+ {
+ return new ValidationResult(false, "Input is not valid. Expected a number or a string like \"1.5 kg\".");
+ }
try
{
- return ParseUnit(value, targetType);
+ // If input is just a number, use the configured default unit
+ if (double.TryParse(valueString, out double number))
+ {
+ Type unitEnumType = Quantity.Infos.First(qi => qi.ValueType == targetType).UnitType;
+ Enum defaultUnit = _settings.GetDefaultUnit(unitEnumType);
+ return Quantity.From(number, defaultUnit);
+ }
+
+ // Otherwise try to parse the string, such as "1.5 kg"
+ return Quantity.Parse(targetType, valueString);
}
catch (Exception e)
{
- return new ValidationResult(false, e.InnerException.Message);
+ return new ValidationResult(false, e.InnerException?.Message ?? e.Message);
}
}
-
- private static object ParseDouble(Type targetType, double number, Type unitEnumType, object unitEnumValue)
- {
- return targetType
- .GetMethod("From", new[] { typeof(QuantityValue), unitEnumType })
- .Invoke(null, new object[] { (QuantityValue)number, unitEnumValue });
- }
-
- private static object ParseUnit(object value, Type targetType)
- {
- return targetType
- .GetMethod("Parse", new[] { typeof(string) })
- .Invoke(null, new object[] { value });
- }
-
public override object ProvideValue(IServiceProvider serviceProvider)
{
return _instance ?? (_instance = new UnitToStringConverter());
diff --git a/Samples/WpfMVVMSample/WpfMVVMSample/Settings/SettingsManager.cs b/Samples/WpfMVVMSample/WpfMVVMSample/Settings/SettingsManager.cs
index 9aa777ebf0..659865b724 100644
--- a/Samples/WpfMVVMSample/WpfMVVMSample/Settings/SettingsManager.cs
+++ b/Samples/WpfMVVMSample/WpfMVVMSample/Settings/SettingsManager.cs
@@ -1,27 +1,24 @@
using Prism.Mvvm;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using UnitsNet.Units;
namespace WpfMVVMSample.Settings
{
public class SettingsManager : BindableBase
{
- private Dictionary> _defaultUnitProviders;
+ private readonly Dictionary> _defaultUnitProviders;
public SettingsManager()
{
DefaultMassUnit = MassUnit.Kilogram;
DefaultAccelerationUnit = AccelerationUnit.MeterPerSecondSquared;
DefaultForceUnit = ForceUnit.Newton;
- _defaultUnitProviders = new Dictionary>
+ _defaultUnitProviders = new Dictionary>
{
- {typeof(MassUnit),()=> this.DefaultMassUnit },
- {typeof(AccelerationUnit),()=> this.DefaultAccelerationUnit },
- {typeof(ForceUnit),()=> this.DefaultForceUnit },
+ {typeof(MassUnit), () => DefaultMassUnit},
+ {typeof(AccelerationUnit), () => DefaultAccelerationUnit},
+ {typeof(ForceUnit), () => DefaultForceUnit},
};
}
@@ -46,7 +43,7 @@ public ForceUnit DefaultForceUnit
set { SetProperty(ref _defaultForceUnit, value); }
}
- public object GetDefaultUnit(Type unitType)
+ public Enum GetDefaultUnit(Type unitType)
{
if (_defaultUnitProviders.ContainsKey(unitType))
{
diff --git a/UnitsNet.Tests/QuantityInfoTest.cs b/UnitsNet.Tests/QuantityInfoTest.cs
new file mode 100644
index 0000000000..a0a0124b9e
--- /dev/null
+++ b/UnitsNet.Tests/QuantityInfoTest.cs
@@ -0,0 +1,133 @@
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using UnitsNet.Units;
+using Xunit;
+
+namespace UnitsNet.Tests
+{
+ public class QuantityInfoTest
+ {
+ [Fact]
+ public void Constructor_AssignsProperties()
+ {
+ var expectedZero = Length.FromCentimeters(10);
+ var expectedUnits = new Enum[] {LengthUnit.Centimeter, LengthUnit.Kilometer};
+ var expectedBaseUnit = LengthUnit.Meter;
+ var expectedQuantityType = QuantityType.Length;
+ var expectedBaseDimensions = Length.BaseDimensions;
+
+ var info = new QuantityInfo(expectedQuantityType, expectedUnits, expectedBaseUnit, expectedZero, expectedBaseDimensions);
+
+ Assert.Equal(expectedZero, info.Zero);
+ Assert.Equal("Length", info.Name);
+ Assert.Equal(expectedUnits, info.Units);
+ Assert.Equal(expectedBaseUnit, info.BaseUnit);
+ Assert.Equal(new[]{"Centimeter", "Kilometer"}, info.UnitNames);
+ Assert.Equal(expectedQuantityType, info.QuantityType);
+ Assert.Equal(expectedBaseDimensions, info.BaseDimensions);
+ }
+
+ [Fact]
+ public void GenericsConstructor_AssignsProperties()
+ {
+ var expectedZero = Length.FromCentimeters(10);
+ var expectedUnits = new[] {LengthUnit.Centimeter, LengthUnit.Kilometer};
+ var expectedBaseUnit = LengthUnit.Meter;
+ var expectedQuantityType = QuantityType.Length;
+ var expectedBaseDimensions = Length.BaseDimensions;
+
+ var info = new QuantityInfo(expectedQuantityType, expectedUnits, expectedBaseUnit, expectedZero, expectedBaseDimensions);
+
+ Assert.Equal(expectedZero, info.Zero);
+ Assert.Equal("Length", info.Name);
+ Assert.Equal(expectedUnits, info.Units);
+ Assert.Equal(expectedBaseUnit, info.BaseUnit);
+ Assert.Equal(new[]{"Centimeter", "Kilometer"}, info.UnitNames);
+ Assert.Equal(expectedQuantityType, info.QuantityType);
+ Assert.Equal(expectedBaseDimensions, info.BaseDimensions);
+ }
+
+ [Fact]
+ public void Constructor_GivenUndefinedAsQuantityType_ThrowsArgumentException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Undefined, new Enum[0], Length.BaseUnit, Length.Zero, Length.BaseDimensions));
+ }
+
+ [Fact]
+ public void GenericsConstructor_GivenUndefinedAsQuantityType_ThrowsArgumentException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Undefined, Length.Units, Length.BaseUnit, Length.Zero, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void Constructor_GivenNullAsUnits_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, null, Length.BaseUnit, Length.Zero, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void GenericsConstructor_GivenNullAsUnits_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, null, Length.BaseUnit, Length.Zero, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void Constructor_GivenNullAsBaseUnit_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, new Enum[0], null, Length.Zero, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void Constructor_GivenNullAsZero_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, new Enum[0], Length.BaseUnit, null, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void GenericsConstructor_GivenNullAsZero_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, Length.Units, Length.BaseUnit, null, Length.BaseDimensions));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void Constructor_GivenNullAsBaseDimensions_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, new Enum[0], Length.BaseUnit, Length.Zero, null));
+ }
+
+ [Fact]
+ [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
+ public void GenericsConstructor_GivenNullAsBaseDimensions_ThrowsArgumentNullException()
+ {
+ Assert.Throws(() => new QuantityInfo(QuantityType.Length, Length.Units, Length.BaseUnit, Length.Zero, null));
+ }
+ }
+}
diff --git a/UnitsNet.Tests/QuantityTest.cs b/UnitsNet.Tests/QuantityTest.cs
new file mode 100644
index 0000000000..d5593f93ad
--- /dev/null
+++ b/UnitsNet.Tests/QuantityTest.cs
@@ -0,0 +1,187 @@
+// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
+// https://github.com/angularsen/UnitsNet
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Globalization;
+using System.Linq;
+using UnitsNet.Units;
+using Xunit;
+
+namespace UnitsNet.Tests
+{
+ public class QuantityTest
+ {
+ // Exclude Undefined value
+ private static readonly int QuantityCount = Enum.GetValues(typeof(QuantityType)).Length - 1;
+
+ [Theory]
+ [InlineData(double.NaN)]
+ [InlineData(double.PositiveInfinity)]
+ [InlineData(double.NegativeInfinity)]
+ public void From_GivenNaNOrInfinity_ThrowsArgumentException(double value)
+ {
+ Assert.Throws(() => Quantity.From(value, LengthUnit.Centimeter));
+ }
+
+ [Theory]
+ [InlineData(double.NaN)]
+ [InlineData(double.PositiveInfinity)]
+ [InlineData(double.NegativeInfinity)]
+ public void TryFrom_GivenNaNOrInfinity_ReturnsFalseAndNullQuantity(double value)
+ {
+ Assert.False(Quantity.TryFrom(value, LengthUnit.Centimeter, out IQuantity parsedLength));
+ Assert.Null(parsedLength);
+ }
+
+ [Fact]
+ public void From_GivenValueAndUnit_ReturnsQuantity()
+ {
+ Assert.Equal(Length.FromCentimeters(3), Quantity.From(3, LengthUnit.Centimeter));
+ Assert.Equal(Mass.FromTonnes(3), Quantity.From(3, MassUnit.Tonne));
+ Assert.Equal(Pressure.FromMegabars(3), Quantity.From(3, PressureUnit.Megabar));
+ }
+
+ [Fact]
+ public void GetInfo_GivenLength_ReturnsQuantityInfoForLength()
+ {
+ var knownLengthUnits = new Enum[] {LengthUnit.Meter, LengthUnit.Centimeter, LengthUnit.Kilometer};
+ var knownLengthUnitNames = new[] {"Meter", "Centimeter", "Kilometer"};
+ var lengthUnitCount = Enum.GetValues(typeof(LengthUnit)).Length - 1; // Exclude LengthUnit.Undefined
+
+ QuantityInfo quantityInfo = Quantity.GetInfo(QuantityType.Length);
+
+ Assert.Equal("Length", quantityInfo.Name);
+ Assert.Equal(QuantityType.Length, quantityInfo.QuantityType);
+ Assert.Superset(knownLengthUnitNames.ToHashSet(), quantityInfo.UnitNames.ToHashSet());
+ Assert.Superset(knownLengthUnits.ToHashSet(), quantityInfo.Units.ToHashSet());
+ Assert.Equal(lengthUnitCount, quantityInfo.UnitNames.Length);
+ Assert.Equal(lengthUnitCount, quantityInfo.Units.Length);
+ Assert.Equal(typeof(LengthUnit), quantityInfo.UnitType);
+ Assert.Equal(typeof(Length), quantityInfo.ValueType);
+ Assert.Equal(Length.Zero, quantityInfo.Zero);
+ }
+
+ [Fact]
+ public void GetInfo_GivenMass_ReturnsQuantityInfoForMass()
+ {
+ var knownMassUnits = new Enum[] {MassUnit.Kilogram, MassUnit.Gram, MassUnit.Tonne};
+ var knownMassUnitNames = new[] {"Kilogram", "Gram", "Tonne"};
+ var massUnitCount = Enum.GetValues(typeof(MassUnit)).Length - 1; // Exclude MassUnit.Undefined
+
+ QuantityInfo quantityInfo = Quantity.GetInfo(QuantityType.Mass);
+
+ Assert.Equal("Mass", quantityInfo.Name);
+ Assert.Equal(QuantityType.Mass, quantityInfo.QuantityType);
+ Assert.Superset(knownMassUnitNames.ToHashSet(), quantityInfo.UnitNames.ToHashSet());
+ Assert.Superset(knownMassUnits.ToHashSet(), quantityInfo.Units.ToHashSet());
+ Assert.Equal(massUnitCount, quantityInfo.UnitNames.Length);
+ Assert.Equal(massUnitCount, quantityInfo.Units.Length);
+ Assert.Equal(typeof(MassUnit), quantityInfo.UnitType);
+ Assert.Equal(typeof(Mass), quantityInfo.ValueType);
+ Assert.Equal(Mass.Zero, quantityInfo.Zero);
+ }
+
+ [Fact]
+ public void Infos_ReturnsKnownQuantityInfoObjects()
+ {
+ var knownQuantityInfos = new[]
+ {
+ Quantity.GetInfo(QuantityType.Length),
+ Quantity.GetInfo(QuantityType.Force),
+ Quantity.GetInfo(QuantityType.Mass)
+ };
+
+ var infos = Quantity.Infos;
+
+ Assert.Superset(knownQuantityInfos.ToHashSet(), infos.ToHashSet());
+ Assert.Equal(QuantityCount, infos.Length);
+ }
+
+ [Fact]
+ public void Parse_GivenValueAndUnit_ReturnsQuantity()
+ {
+ Assert.Equal(Length.FromCentimeters(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Length), "3 cm"));
+ Assert.Equal(Mass.FromTonnes(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Mass), "03t"));
+ Assert.Equal(Pressure.FromMegabars(3), Quantity.Parse(CultureInfo.InvariantCulture, typeof(Pressure), "3.0 Mbar"));
+ }
+
+ [Fact]
+ public void QuantityNames_ReturnsKnownNames()
+ {
+ var knownNames = new[] {"Length", "Force", "Mass"};
+
+ var names = Quantity.Names;
+
+ Assert.Superset(knownNames.ToHashSet(), names.ToHashSet());
+ Assert.Equal(QuantityCount, names.Length);
+ }
+
+ [Fact]
+ public void TryFrom_GivenValueAndUnit_ReturnsQuantity()
+ {
+ Assert.True(Quantity.TryFrom(3, LengthUnit.Centimeter, out IQuantity parsedLength));
+ Assert.Equal(Length.FromCentimeters(3), parsedLength);
+
+ Assert.True(Quantity.TryFrom(3, MassUnit.Tonne, out IQuantity parsedMass));
+ Assert.Equal(Mass.FromTonnes(3), parsedMass);
+
+ Assert.True(Quantity.TryFrom(3, PressureUnit.Megabar, out IQuantity parsedPressure));
+ Assert.Equal(Pressure.FromMegabars(3), parsedPressure);
+ }
+
+ [Fact]
+ public void TryParse_GivenInvalidString_ReturnsFalseAndNullQuantity()
+ {
+ Assert.False(Quantity.TryParse(typeof(Length), "x cm", out IQuantity parsedLength));
+ Assert.Null(parsedLength);
+
+ Assert.False(Quantity.TryParse(typeof(Mass), "xt", out IQuantity parsedMass));
+ Assert.Null(parsedMass);
+
+ Assert.False(Quantity.TryParse(typeof(Pressure), "foo", out IQuantity parsedPressure));
+ Assert.Null(parsedPressure);
+ }
+
+ [Fact]
+ public void TryParse_GivenValueAndUnit_ReturnsQuantity()
+ {
+ Assert.True(Quantity.TryParse(typeof(Length), "3 cm", out IQuantity parsedLength));
+ Assert.Equal(Length.FromCentimeters(3), parsedLength);
+
+ Assert.True(Quantity.TryParse(typeof(Mass), "03t", out IQuantity parsedMass));
+ Assert.Equal(Mass.FromTonnes(3), parsedMass);
+
+ Assert.True(Quantity.TryParse(typeof(Pressure), "3.0 Mbar", out IQuantity parsedPressure));
+ Assert.Equal(Pressure.FromMegabars(3), parsedPressure);
+ }
+
+ [Fact]
+ public void Types_ReturnsKnownQuantityTypes()
+ {
+ var knownQuantities = new[] {QuantityType.Length, QuantityType.Force, QuantityType.Mass};
+
+ var types = Quantity.Types;
+
+ Assert.Superset(knownQuantities.ToHashSet(), types.ToHashSet());
+ Assert.Equal(QuantityCount, types.Length);
+ }
+ }
+}
diff --git a/UnitsNet.Tests/QuantityTests.cs b/UnitsNet.Tests/QuantityTests.cs
index cec7093e68..d0521745f5 100644
--- a/UnitsNet.Tests/QuantityTests.cs
+++ b/UnitsNet.Tests/QuantityTests.cs
@@ -1,16 +1,16 @@
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
-//
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -19,6 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using System.Linq;
using UnitsNet.Units;
using Xunit;
@@ -34,5 +35,36 @@ public void GetHashCodeForDifferentQuantitiesWithSameValuesAreNotEqual()
Assert.NotEqual( length.GetHashCode(), area.GetHashCode() );
}
+
+ [Fact]
+ public void Length_QuantityInfo_ReturnsQuantityInfoAboutLength()
+ {
+ var length = new Length(1, LengthUnit.Centimeter);
+
+ QuantityInfo quantityInfo = length.QuantityInfo;
+
+ AssertQuantityInfoRepresentsLength(quantityInfo);
+ }
+
+ [Fact]
+ public void Length_Info_ReturnsQuantityInfoAboutLength()
+ {
+ QuantityInfo quantityInfo = Length.Info;
+
+ AssertQuantityInfoRepresentsLength(quantityInfo);
+ }
+
+ private static void AssertQuantityInfoRepresentsLength(QuantityInfo quantityInfo)
+ {
+ Assert.Equal(Length.Zero, quantityInfo.Zero);
+ Assert.Equal("Length", quantityInfo.Name);
+
+ var lengthUnits = EnumUtils.GetEnumValues().Except(new[] {LengthUnit.Undefined}).ToArray();
+ Assert.Equal(lengthUnits, quantityInfo.Units);
+ Assert.Equal(QuantityType.Length, quantityInfo.QuantityType);
+
+ var lengthUnitNames = lengthUnits.Select(x => x.ToString());
+ Assert.Equal(lengthUnitNames, quantityInfo.UnitNames);
+ }
}
}
diff --git a/UnitsNet.Tests/UnitConverterTest.cs b/UnitsNet.Tests/UnitConverterTest.cs
index 75ce44a1b6..5af66cbef3 100644
--- a/UnitsNet.Tests/UnitConverterTest.cs
+++ b/UnitsNet.Tests/UnitConverterTest.cs
@@ -1,16 +1,16 @@
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
-//
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -50,9 +50,9 @@ public void ConvertByName_UnitTypeCaseInsensitive()
[Theory]
[InlineData(1, "UnknownQuantity", "Meter", "Centimeter")]
- public void ConvertByName_ThrowsQuantityNotFoundExceptionOnUnknownQuantity(double inputValue, string quantityTypeName, string fromUnit, string toUnit)
+ public void ConvertByName_ThrowsUnitNotFoundExceptionOnUnknownQuantity(double inputValue, string quantityTypeName, string fromUnit, string toUnit)
{
- Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit));
+ Assert.Throws(() => UnitConverter.ConvertByName(inputValue, quantityTypeName, fromUnit, toUnit));
}
[Theory]
@@ -132,4 +132,4 @@ public void TryConvertByAbbreviation_ReturnsTrueOnSuccessAndOutputsResult(double
Assert.Equal(expectedValue, result);
}
}
-}
\ No newline at end of file
+}
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs
index 94443bd88f..08f57cb762 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Acceleration.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Acceleration : IQuantity
static Acceleration()
{
BaseDimensions = new BaseDimensions(1, 0, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Acceleration, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit MeterPerSecondSquared.
@@ -98,6 +99,9 @@ private Acceleration(double numericValue, AccelerationUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Acceleration(double numericValue, AccelerationUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -643,6 +652,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AccelerationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs
index d12377f8cd..ab477ea159 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmountOfSubstance.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class AmountOfSubstance : IQuantity
static AmountOfSubstance()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0);
+ Info = new QuantityInfo(QuantityType.AmountOfSubstance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Mole.
@@ -98,6 +99,9 @@ private AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -673,6 +682,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AmountOfSubstanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs
index d21e5fc694..1b19e346c9 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AmplitudeRatio.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class AmplitudeRatio : IQuantity
static AmplitudeRatio()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.AmplitudeRatio, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit DecibelVolt.
@@ -98,6 +99,9 @@ private AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -508,6 +517,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AmplitudeRatioUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs
index 3d9cf1e03d..26227b6896 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Angle.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Angle : IQuantity
static Angle()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.Angle, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Degree.
@@ -98,6 +99,9 @@ private Angle(double numericValue, AngleUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Angle(double numericValue, AngleUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -658,6 +667,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AngleUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs
index 4cc4e3372b..390ae19a53 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentEnergy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ApparentEnergy : IQuantity
static ApparentEnergy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ApparentEnergy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltampereHour.
@@ -98,6 +99,9 @@ private ApparentEnergy(double numericValue, ApparentEnergyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ApparentEnergy(double numericValue, ApparentEnergyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ApparentEnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs
index 688c067c0b..8f2c2c4be5 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ApparentPower.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ApparentPower : IQuantity
static ApparentPower()
{
BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ApparentPower, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Voltampere.
@@ -98,6 +99,9 @@ private ApparentPower(double numericValue, ApparentPowerUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ApparentPower(double numericValue, ApparentPowerUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -508,6 +517,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ApparentPowerUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs
index fcbc55be4a..e1d7b01e00 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Area.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Area : IQuantity
static Area()
{
BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Area, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit SquareMeter.
@@ -98,6 +99,9 @@ private Area(double numericValue, AreaUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Area(double numericValue, AreaUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -643,6 +652,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AreaUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs
index 3c0ed1599b..a8be923f84 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaDensity.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class AreaDensity : IQuantity
static AreaDensity()
{
BaseDimensions = new BaseDimensions(-2, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.AreaDensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerSquareMeter.
@@ -98,6 +99,9 @@ private AreaDensity(double numericValue, AreaDensityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private AreaDensity(double numericValue, AreaDensityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -463,6 +472,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AreaDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs
index 80f4284676..13bba944ea 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/AreaMomentOfInertia.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class AreaMomentOfInertia : IQuantity
static AreaMomentOfInertia()
{
BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.AreaMomentOfInertia, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit MeterToTheFourth.
@@ -98,6 +99,9 @@ private AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -538,6 +547,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((AreaMomentOfInertiaUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs
index 2c1d25a564..1c491a0427 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BitRate.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class BitRate : IQuantity
static BitRate()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.BitRate, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit BitPerSecond.
@@ -101,6 +102,9 @@ private BitRate(decimal numericValue, BitRateUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private BitRate(decimal numericValue, BitRateUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -841,6 +850,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((BitRateUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs
index 131983f29c..63577de814 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class BrakeSpecificFuelConsumption : IQuantity
static BrakeSpecificFuelConsumption()
{
BaseDimensions = new BaseDimensions(-2, 0, 2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.BrakeSpecificFuelConsumption, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerJoule.
@@ -98,6 +99,9 @@ private BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsu
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsu
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((BrakeSpecificFuelConsumptionUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs
index 5a8f365de0..d445ff36ac 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Capacitance.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Capacitance : IQuantity
static Capacitance()
{
BaseDimensions = new BaseDimensions(-2, -1, 4, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Capacitance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Farad.
@@ -101,6 +102,9 @@ private Capacitance(double numericValue, CapacitanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Capacitance(double numericValue, CapacitanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -556,6 +565,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((CapacitanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs
index 4902ecaf69..3ed7417b39 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class CoefficientOfThermalExpansion : IQuantity
static CoefficientOfThermalExpansion()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, -1, 0, 0);
+ Info = new QuantityInfo(QuantityType.CoefficientOfThermalExpansion, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit InverseKelvin.
@@ -98,6 +99,9 @@ private CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalE
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalE
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((CoefficientOfThermalExpansionUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs
index 2c40ddcdb0..cc3d021307 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Density.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Density : IQuantity
static Density()
{
BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Density, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerCubicMeter.
@@ -101,6 +102,9 @@ private Density(double numericValue, DensityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Density(double numericValue, DensityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -1036,6 +1045,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((DensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs
index 8efdc33abc..a8f79b1e2c 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Duration.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Duration : IQuantity
static Duration()
{
BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Duration, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Second.
@@ -98,6 +99,9 @@ private Duration(double numericValue, DurationUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Duration(double numericValue, DurationUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -598,6 +607,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((DurationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs
index 10692d435a..50bb51042c 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/DynamicViscosity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class DynamicViscosity : IQuantity
static DynamicViscosity()
{
BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.DynamicViscosity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonSecondPerMeterSquared.
@@ -101,6 +102,9 @@ private DynamicViscosity(double numericValue, DynamicViscosityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private DynamicViscosity(double numericValue, DynamicViscosityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -541,6 +550,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((DynamicViscosityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs
index f76c280ffe..c9bf26be0e 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricAdmittance.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricAdmittance : IQuantity
static ElectricAdmittance()
{
BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricAdmittance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Siemens.
@@ -98,6 +99,9 @@ private ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -508,6 +517,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricAdmittanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs
index 0b97812a5e..77bf1358bf 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCharge.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricCharge : IQuantity
static ElectricCharge()
{
BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricCharge, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Coulomb.
@@ -101,6 +102,9 @@ private ElectricCharge(double numericValue, ElectricChargeUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricCharge(double numericValue, ElectricChargeUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricChargeUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricChargeUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs
index a72d719df7..827946f8b4 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricChargeDensity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricChargeDensity : IQuantity
static ElectricChargeDensity()
{
BaseDimensions = new BaseDimensions(-3, 0, 1, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricChargeDensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit CoulombPerCubicMeter.
@@ -101,6 +102,9 @@ private ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit uni
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricChargeDensity(double numericValue, ElectricChargeDensityUnit uni
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricChargeDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricChargeDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs
index 9b2353aa76..d2d87b54cc 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductance.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricConductance : IQuantity
static ElectricConductance()
{
BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricConductance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Siemens.
@@ -101,6 +102,9 @@ private ElectricConductance(double numericValue, ElectricConductanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricConductance(double numericValue, ElectricConductanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricConductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -496,6 +505,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricConductanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs
index d463e98045..d250c836b8 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricConductivity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricConductivity : IQuantity
static ElectricConductivity()
{
BaseDimensions = new BaseDimensions(-3, -1, 3, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricConductivity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit SiemensPerMeter.
@@ -101,6 +102,9 @@ private ElectricConductivity(double numericValue, ElectricConductivityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricConductivity(double numericValue, ElectricConductivityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricConductivityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs
index 03021b033b..959579febb 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrent.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricCurrent : IQuantity
static ElectricCurrent()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricCurrent, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Ampere.
@@ -98,6 +99,9 @@ private ElectricCurrent(double numericValue, ElectricCurrentUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricCurrent(double numericValue, ElectricCurrentUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricCurrentUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -568,6 +577,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricCurrentUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs
index 947625b277..63be2d2ddc 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentDensity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricCurrentDensity : IQuantity
static ElectricCurrentDensity()
{
BaseDimensions = new BaseDimensions(-2, 0, 0, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricCurrentDensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit AmperePerSquareMeter.
@@ -101,6 +102,9 @@ private ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit u
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricCurrentDensity(double numericValue, ElectricCurrentDensityUnit u
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricCurrentDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricCurrentDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs
index 5bf58fa07e..33000fe1ba 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricCurrentGradient.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricCurrentGradient : IQuantity
static ElectricCurrentGradient()
{
BaseDimensions = new BaseDimensions(0, 0, -1, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricCurrentGradient, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit AmperePerSecond.
@@ -98,6 +99,9 @@ private ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricCurrentGradient(double numericValue, ElectricCurrentGradientUnit
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricCurrentGradientUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -463,6 +472,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricCurrentGradientUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs
index db0428419f..844c64b25d 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricField.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricField : IQuantity
static ElectricField()
{
BaseDimensions = new BaseDimensions(1, 1, -3, -1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricField, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltPerMeter.
@@ -101,6 +102,9 @@ private ElectricField(double numericValue, ElectricFieldUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricField(double numericValue, ElectricFieldUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricFieldUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs
index ad3717ead6..e3c4912972 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricInductance.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricInductance : IQuantity
static ElectricInductance()
{
BaseDimensions = new BaseDimensions(2, 1, -2, -2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricInductance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Henry.
@@ -101,6 +102,9 @@ private ElectricInductance(double numericValue, ElectricInductanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricInductance(double numericValue, ElectricInductanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricInductanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -511,6 +520,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricInductanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs
index 438a68a7fe..b72cd51609 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotential.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricPotential : IQuantity
static ElectricPotential()
{
BaseDimensions = new BaseDimensions(2, 1, -3, -1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricPotential, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Volt.
@@ -98,6 +99,9 @@ private ElectricPotential(double numericValue, ElectricPotentialUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricPotential(double numericValue, ElectricPotentialUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricPotentialUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -523,6 +532,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricPotentialUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs
index 8c934c4ea6..9db5653f18 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialAc.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricPotentialAc : IQuantity
static ElectricPotentialAc()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.ElectricPotentialAc, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltAc.
@@ -98,6 +99,9 @@ private ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricPotentialAc(double numericValue, ElectricPotentialAcUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricPotentialAcUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -523,6 +532,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricPotentialAcUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs
index 4752150d04..402f18a4b5 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricPotentialDc.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricPotentialDc : IQuantity
static ElectricPotentialDc()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.ElectricPotentialDc, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltDc.
@@ -98,6 +99,9 @@ private ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricPotentialDc(double numericValue, ElectricPotentialDcUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricPotentialDcUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -523,6 +532,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricPotentialDcUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs
index f9734c9e9b..5d58571ed2 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistance.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ElectricResistance : IQuantity
static ElectricResistance()
{
BaseDimensions = new BaseDimensions(2, 1, -3, -2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricResistance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Ohm.
@@ -98,6 +99,9 @@ private ElectricResistance(double numericValue, ElectricResistanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ElectricResistance(double numericValue, ElectricResistanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -523,6 +532,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricResistanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs
index da7f2187cb..111976cce3 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ElectricResistivity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ElectricResistivity : IQuantity
static ElectricResistivity()
{
BaseDimensions = new BaseDimensions(3, 1, -3, -2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricResistivity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit OhmMeter.
@@ -101,6 +102,9 @@ private ElectricResistivity(double numericValue, ElectricResistivityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ElectricResistivity(double numericValue, ElectricResistivityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricResistivityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -661,6 +670,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ElectricResistivityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs
index 17cf032399..2e6350f72e 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Energy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Energy : IQuantity
static Energy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Energy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Joule.
@@ -98,6 +99,9 @@ private Energy(double numericValue, EnergyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Energy(double numericValue, EnergyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public EnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -778,6 +787,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((EnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs
index ef0f26a47a..b007d5a46a 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Entropy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Entropy : IQuantity
static Entropy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, 0, 0);
+ Info = new QuantityInfo(QuantityType.Entropy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerKelvin.
@@ -98,6 +99,9 @@ private Entropy(double numericValue, EntropyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Entropy(double numericValue, EntropyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public EntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -553,6 +562,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((EntropyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs
index 389158cd90..b4d5d7b3fa 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Force.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Force : IQuantity
static Force()
{
BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Force, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Newton.
@@ -98,6 +99,9 @@ private Force(double numericValue, ForceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Force(double numericValue, ForceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ForceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -643,6 +652,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ForceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs
index 6ae9f79fc4..520985c5b1 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForceChangeRate.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ForceChangeRate : IQuantity
static ForceChangeRate()
{
BaseDimensions = new BaseDimensions(1, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ForceChangeRate, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonPerSecond.
@@ -98,6 +99,9 @@ private ForceChangeRate(double numericValue, ForceChangeRateUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ForceChangeRate(double numericValue, ForceChangeRateUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ForceChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -613,6 +622,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ForceChangeRateUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs
index cb16d22827..f6ebfbf655 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ForcePerLength.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ForcePerLength : IQuantity
static ForcePerLength()
{
BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ForcePerLength, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonPerMeter.
@@ -98,6 +99,9 @@ private ForcePerLength(double numericValue, ForcePerLengthUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ForcePerLength(double numericValue, ForcePerLengthUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ForcePerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -583,6 +592,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ForcePerLengthUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs
index a7378ba6cc..6e028b8fe7 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Frequency.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Frequency : IQuantity
static Frequency()
{
BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Frequency, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Hertz.
@@ -98,6 +99,9 @@ private Frequency(double numericValue, FrequencyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Frequency(double numericValue, FrequencyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public FrequencyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -568,6 +577,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((FrequencyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs
index 69a30764ff..4419bc6b87 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatFlux.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class HeatFlux : IQuantity
static HeatFlux()
{
BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.HeatFlux, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter.
@@ -98,6 +99,9 @@ private HeatFlux(double numericValue, HeatFluxUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private HeatFlux(double numericValue, HeatFluxUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public HeatFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -718,6 +727,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((HeatFluxUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs
index d939b00b16..cce8f794b0 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/HeatTransferCoefficient.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class HeatTransferCoefficient : IQuantity
static HeatTransferCoefficient()
{
BaseDimensions = new BaseDimensions(0, 1, -3, 0, -1, 0, 0);
+ Info = new QuantityInfo(QuantityType.HeatTransferCoefficient, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit WattPerSquareMeterKelvin.
@@ -98,6 +99,9 @@ private HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private HeatTransferCoefficient(double numericValue, HeatTransferCoefficientUnit
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public HeatTransferCoefficientUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -478,6 +487,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((HeatTransferCoefficientUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs
index db8d457c27..babc32c9e9 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Illuminance.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Illuminance : IQuantity
static Illuminance()
{
BaseDimensions = new BaseDimensions(-2, 0, 0, 0, 0, 0, 1);
+ Info = new QuantityInfo(QuantityType.Illuminance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Lux.
@@ -101,6 +102,9 @@ private Illuminance(double numericValue, IlluminanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Illuminance(double numericValue, IlluminanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public IlluminanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -511,6 +520,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((IlluminanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs
index 22455abe25..d45c12c6c3 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Information.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Information : IQuantity
static Information()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.Information, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Bit.
@@ -98,6 +99,9 @@ private Information(decimal numericValue, InformationUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Information(decimal numericValue, InformationUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public InformationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -838,6 +847,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((InformationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs
index e8bc9ba2cb..445be64d67 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiance.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Irradiance : IQuantity
static Irradiance()
{
BaseDimensions = new BaseDimensions(0, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Irradiance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit WattPerSquareMeter.
@@ -98,6 +99,9 @@ private Irradiance(double numericValue, IrradianceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Irradiance(double numericValue, IrradianceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public IrradianceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -658,6 +667,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((IrradianceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs
index ac31b948fa..2050069d52 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Irradiation.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Irradiation : IQuantity
static Irradiation()
{
BaseDimensions = new BaseDimensions(0, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Irradiation, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerSquareMeter.
@@ -101,6 +102,9 @@ private Irradiation(double numericValue, IrradiationUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Irradiation(double numericValue, IrradiationUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public IrradiationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -511,6 +520,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((IrradiationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs
index 850806d6d3..fd88a5a316 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/KinematicViscosity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class KinematicViscosity : IQuantity
static KinematicViscosity()
{
BaseDimensions = new BaseDimensions(2, 0, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.KinematicViscosity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit SquareMeterPerSecond.
@@ -101,6 +102,9 @@ private KinematicViscosity(double numericValue, KinematicViscosityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private KinematicViscosity(double numericValue, KinematicViscosityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public KinematicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -571,6 +580,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((KinematicViscosityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs
index c06e9e8ff7..35ceb88570 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LapseRate.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class LapseRate : IQuantity
static LapseRate()
{
BaseDimensions = new BaseDimensions(-1, 0, 0, 0, 1, 0, 0);
+ Info = new QuantityInfo(QuantityType.LapseRate, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerKilometer.
@@ -98,6 +99,9 @@ private LapseRate(double numericValue, LapseRateUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private LapseRate(double numericValue, LapseRateUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LapseRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -463,6 +472,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LapseRateUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs
index 27c0b1b62e..c7973e5122 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Length.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Length : IQuantity
static Length()
{
BaseDimensions = new BaseDimensions(1, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Length, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Meter.
@@ -98,6 +99,9 @@ private Length(double numericValue, LengthUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Length(double numericValue, LengthUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LengthUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -778,6 +787,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LengthUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs
index 15753301fa..1eb64edd57 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Level.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Level : IQuantity
static Level()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.Level, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Decibel.
@@ -98,6 +99,9 @@ private Level(double numericValue, LevelUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Level(double numericValue, LevelUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LevelUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -478,6 +487,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LevelUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs
index d363005ee2..d31eea0a62 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LinearDensity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class LinearDensity : IQuantity
static LinearDensity()
{
BaseDimensions = new BaseDimensions(-1, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.LinearDensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerMeter.
@@ -101,6 +102,9 @@ private LinearDensity(double numericValue, LinearDensityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private LinearDensity(double numericValue, LinearDensityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LinearDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -496,6 +505,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LinearDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs
index 7ccd8f8ef4..cf67c8c400 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousFlux.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class LuminousFlux : IQuantity
static LuminousFlux()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1);
+ Info = new QuantityInfo(QuantityType.LuminousFlux, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Lumen.
@@ -101,6 +102,9 @@ private LuminousFlux(double numericValue, LuminousFluxUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private LuminousFlux(double numericValue, LuminousFluxUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LuminousFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LuminousFluxUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs
index 0852f82a46..fc0f3fcaae 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/LuminousIntensity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class LuminousIntensity : IQuantity
static LuminousIntensity()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 0, 1);
+ Info = new QuantityInfo(QuantityType.LuminousIntensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Candela.
@@ -101,6 +102,9 @@ private LuminousIntensity(double numericValue, LuminousIntensityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private LuminousIntensity(double numericValue, LuminousIntensityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public LuminousIntensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((LuminousIntensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs
index aa2a621aa7..0c5065cf67 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticField.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class MagneticField : IQuantity
static MagneticField()
{
BaseDimensions = new BaseDimensions(0, 1, -2, -1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.MagneticField, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Tesla.
@@ -101,6 +102,9 @@ private MagneticField(double numericValue, MagneticFieldUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private MagneticField(double numericValue, MagneticFieldUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MagneticFieldUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -511,6 +520,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MagneticFieldUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs
index 4d9a704788..9d896dbfb8 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MagneticFlux.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class MagneticFlux : IQuantity
static MagneticFlux()
{
BaseDimensions = new BaseDimensions(2, 1, -2, -1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.MagneticFlux, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Weber.
@@ -101,6 +102,9 @@ private MagneticFlux(double numericValue, MagneticFluxUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private MagneticFlux(double numericValue, MagneticFluxUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MagneticFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MagneticFluxUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs
index 4291d2a12e..f210e84292 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Magnetization.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Magnetization : IQuantity
static Magnetization()
{
BaseDimensions = new BaseDimensions(-1, 0, 0, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Magnetization, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit AmperePerMeter.
@@ -101,6 +102,9 @@ private Magnetization(double numericValue, MagnetizationUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Magnetization(double numericValue, MagnetizationUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MagnetizationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MagnetizationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs
index fba18671c9..a4c128811a 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Mass.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Mass : IQuantity
static Mass()
{
BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Mass, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Kilogram.
@@ -98,6 +99,9 @@ private Mass(double numericValue, MassUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Mass(double numericValue, MassUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MassUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -793,6 +802,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MassUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs
index 69e0f0b145..987d910866 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlow.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MassFlow : IQuantity
static MassFlow()
{
BaseDimensions = new BaseDimensions(0, 1, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.MassFlow, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit GramPerSecond.
@@ -98,6 +99,9 @@ private MassFlow(double numericValue, MassFlowUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MassFlow(double numericValue, MassFlowUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MassFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -913,6 +922,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MassFlowUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs
index 33d9390752..14957f2075 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassFlux.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MassFlux : IQuantity
static MassFlux()
{
BaseDimensions = new BaseDimensions(-2, 1, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.MassFlux, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerSecondPerSquareMeter.
@@ -98,6 +99,9 @@ private MassFlux(double numericValue, MassFluxUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MassFlux(double numericValue, MassFluxUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MassFluxUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -478,6 +487,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MassFluxUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs
index 893be9d39d..1f74cb4ce4 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MassMomentOfInertia.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MassMomentOfInertia : IQuantity
static MassMomentOfInertia()
{
BaseDimensions = new BaseDimensions(2, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.MassMomentOfInertia, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramSquareMeter.
@@ -98,6 +99,9 @@ private MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MassMomentOfInertia(double numericValue, MassMomentOfInertiaUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MassMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -868,6 +877,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MassMomentOfInertiaUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs
index b67a6bb2eb..401cb0aba3 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEnergy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MolarEnergy : IQuantity
static MolarEnergy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, -1, 0);
+ Info = new QuantityInfo(QuantityType.MolarEnergy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerMole.
@@ -98,6 +99,9 @@ private MolarEnergy(double numericValue, MolarEnergyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MolarEnergy(double numericValue, MolarEnergyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MolarEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MolarEnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs
index 147d033aae..2d2a4236ca 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarEntropy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MolarEntropy : IQuantity
static MolarEntropy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, -1, -1, 0);
+ Info = new QuantityInfo(QuantityType.MolarEntropy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerMoleKelvin.
@@ -98,6 +99,9 @@ private MolarEntropy(double numericValue, MolarEntropyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MolarEntropy(double numericValue, MolarEntropyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MolarEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MolarEntropyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs
index 90b42e3281..72d37e1b2c 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/MolarMass.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class MolarMass : IQuantity
static MolarMass()
{
BaseDimensions = new BaseDimensions(0, 1, 0, 0, 0, -1, 0);
+ Info = new QuantityInfo(QuantityType.MolarMass, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit KilogramPerMole.
@@ -98,6 +99,9 @@ private MolarMass(double numericValue, MolarMassUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private MolarMass(double numericValue, MolarMassUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MolarMassUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -628,6 +637,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MolarMassUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs
index b7be810adf..847c2d8cd0 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Molarity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Molarity : IQuantity
static Molarity()
{
BaseDimensions = new BaseDimensions(-3, 0, 0, 0, 0, 1, 0);
+ Info = new QuantityInfo(QuantityType.Molarity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit MolesPerCubicMeter.
@@ -101,6 +102,9 @@ private Molarity(double numericValue, MolarityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Molarity(double numericValue, MolarityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public MolarityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -571,6 +580,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((MolarityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs
index 512fe996d8..23d96bbe1a 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permeability.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Permeability : IQuantity
static Permeability()
{
BaseDimensions = new BaseDimensions(1, 1, -2, -2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Permeability, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit HenryPerMeter.
@@ -101,6 +102,9 @@ private Permeability(double numericValue, PermeabilityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Permeability(double numericValue, PermeabilityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PermeabilityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PermeabilityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs
index 19ee1e46b7..0e15153f08 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Permittivity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class Permittivity : IQuantity
static Permittivity()
{
BaseDimensions = new BaseDimensions(-3, -1, 4, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Permittivity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit FaradPerMeter.
@@ -101,6 +102,9 @@ private Permittivity(double numericValue, PermittivityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private Permittivity(double numericValue, PermittivityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PermittivityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PermittivityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs
index 53d06b9af2..c41560c5d3 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Power.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Power : IQuantity
static Power()
{
BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Power, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Watt.
@@ -98,6 +99,9 @@ private Power(decimal numericValue, PowerUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Power(decimal numericValue, PowerUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PowerUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -748,6 +757,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PowerUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs
index 49230b2271..8575a58e79 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerDensity.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class PowerDensity : IQuantity
static PowerDensity()
{
BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.PowerDensity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit WattPerCubicMeter.
@@ -98,6 +99,9 @@ private PowerDensity(double numericValue, PowerDensityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private PowerDensity(double numericValue, PowerDensityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PowerDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -1108,6 +1117,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PowerDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs
index 379026875a..2dca1d2d03 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PowerRatio.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class PowerRatio : IQuantity
static PowerRatio()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.PowerRatio, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit DecibelWatt.
@@ -98,6 +99,9 @@ private PowerRatio(double numericValue, PowerRatioUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private PowerRatio(double numericValue, PowerRatioUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PowerRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -478,6 +487,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PowerRatioUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs
index f22554a681..a133a71e82 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Pressure.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Pressure : IQuantity
static Pressure()
{
BaseDimensions = new BaseDimensions(-1, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Pressure, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Pascal.
@@ -98,6 +99,9 @@ private Pressure(double numericValue, PressureUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Pressure(double numericValue, PressureUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PressureUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -1078,6 +1087,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PressureUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs
index 945ea331e7..f0baf28104 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/PressureChangeRate.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class PressureChangeRate : IQuantity
static PressureChangeRate()
{
BaseDimensions = new BaseDimensions(-1, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.PressureChangeRate, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit PascalPerSecond.
@@ -98,6 +99,9 @@ private PressureChangeRate(double numericValue, PressureChangeRateUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private PressureChangeRate(double numericValue, PressureChangeRateUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public PressureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -553,6 +562,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((PressureChangeRateUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs
index 851524fe9d..5f0c10a334 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Ratio.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Ratio : IQuantity
static Ratio()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.Ratio, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit DecimalFraction.
@@ -98,6 +99,9 @@ private Ratio(double numericValue, RatioUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Ratio(double numericValue, RatioUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public RatioUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -538,6 +547,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((RatioUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs
index 69d606ef62..daed0a599a 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactiveEnergy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ReactiveEnergy : IQuantity
static ReactiveEnergy()
{
BaseDimensions = new BaseDimensions(2, 1, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ReactiveEnergy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltampereReactiveHour.
@@ -98,6 +99,9 @@ private ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ReactiveEnergy(double numericValue, ReactiveEnergyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ReactiveEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ReactiveEnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs
index ae479bc556..2653aab6dc 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ReactivePower.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ReactivePower : IQuantity
static ReactivePower()
{
BaseDimensions = new BaseDimensions(2, 1, -3, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ReactivePower, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit VoltampereReactive.
@@ -98,6 +99,9 @@ private ReactivePower(double numericValue, ReactivePowerUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ReactivePower(double numericValue, ReactivePowerUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ReactivePowerUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -508,6 +517,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ReactivePowerUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs
index c8b80cb06d..ac5c2b4f1b 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalAcceleration.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class RotationalAcceleration : IQuantity
static RotationalAcceleration()
{
BaseDimensions = new BaseDimensions(0, 0, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.RotationalAcceleration, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit RadianPerSecondSquared.
@@ -98,6 +99,9 @@ private RotationalAcceleration(double numericValue, RotationalAccelerationUnit u
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private RotationalAcceleration(double numericValue, RotationalAccelerationUnit u
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public RotationalAccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((RotationalAccelerationUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs
index 7dfdd3637c..30219a5001 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalSpeed.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class RotationalSpeed : IQuantity
static RotationalSpeed()
{
BaseDimensions = new BaseDimensions(0, 0, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.RotationalSpeed, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit RadianPerSecond.
@@ -98,6 +99,9 @@ private RotationalSpeed(double numericValue, RotationalSpeedUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private RotationalSpeed(double numericValue, RotationalSpeedUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public RotationalSpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -643,6 +652,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((RotationalSpeedUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs
index c85dc7c89a..814f4e4d8d 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffness.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class RotationalStiffness : IQuantity
static RotationalStiffness()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.RotationalStiffness, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadian.
@@ -98,6 +99,9 @@ private RotationalStiffness(double numericValue, RotationalStiffnessUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private RotationalStiffness(double numericValue, RotationalStiffnessUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public RotationalStiffnessUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((RotationalStiffnessUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs
index 977440ed79..c82828bfa5 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/RotationalStiffnessPerLength.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class RotationalStiffnessPerLength : IQuantity
static RotationalStiffnessPerLength()
{
BaseDimensions = new BaseDimensions(1, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.RotationalStiffnessPerLength, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonMeterPerRadianPerMeter.
@@ -98,6 +99,9 @@ private RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPer
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private RotationalStiffnessPerLength(double numericValue, RotationalStiffnessPer
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public RotationalStiffnessPerLengthUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((RotationalStiffnessPerLengthUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs
index d2a27d85c9..ffe3b92393 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SolidAngle.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class SolidAngle : IQuantity
static SolidAngle()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.SolidAngle, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Steradian.
@@ -101,6 +102,9 @@ private SolidAngle(double numericValue, SolidAngleUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private SolidAngle(double numericValue, SolidAngleUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SolidAngleUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -466,6 +475,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SolidAngleUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs
index 3703e3b3c9..e2f16162b0 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEnergy.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class SpecificEnergy : IQuantity
static SpecificEnergy()
{
BaseDimensions = new BaseDimensions(2, 0, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.SpecificEnergy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerKilogram.
@@ -101,6 +102,9 @@ private SpecificEnergy(double numericValue, SpecificEnergyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private SpecificEnergy(double numericValue, SpecificEnergyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SpecificEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -586,6 +595,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SpecificEnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs
index 60cad92d7c..ce8c7c1ff9 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificEntropy.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class SpecificEntropy : IQuantity
static SpecificEntropy()
{
BaseDimensions = new BaseDimensions(2, 0, -2, 0, -1, 0, 0);
+ Info = new QuantityInfo(QuantityType.SpecificEntropy, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit JoulePerKilogramKelvin.
@@ -98,6 +99,9 @@ private SpecificEntropy(double numericValue, SpecificEntropyUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private SpecificEntropy(double numericValue, SpecificEntropyUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SpecificEntropyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -568,6 +577,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SpecificEntropyUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs
index f9a0d75ea9..c81b3663b1 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificVolume.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class SpecificVolume : IQuantity
static SpecificVolume()
{
BaseDimensions = new BaseDimensions(3, -1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.SpecificVolume, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit CubicMeterPerKilogram.
@@ -98,6 +99,9 @@ private SpecificVolume(double numericValue, SpecificVolumeUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private SpecificVolume(double numericValue, SpecificVolumeUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SpecificVolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -493,6 +502,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SpecificVolumeUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs
index bedc38f78a..22f85c0db9 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/SpecificWeight.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class SpecificWeight : IQuantity
static SpecificWeight()
{
BaseDimensions = new BaseDimensions(-2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.SpecificWeight, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonPerCubicMeter.
@@ -101,6 +102,9 @@ private SpecificWeight(double numericValue, SpecificWeightUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private SpecificWeight(double numericValue, SpecificWeightUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SpecificWeightUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -706,6 +715,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SpecificWeightUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs
index 76cb7ebae1..7595102c52 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Speed.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Speed : IQuantity
static Speed()
{
BaseDimensions = new BaseDimensions(1, 0, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Speed, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit MeterPerSecond.
@@ -98,6 +99,9 @@ private Speed(double numericValue, SpeedUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Speed(double numericValue, SpeedUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public SpeedUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -928,6 +937,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((SpeedUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs
index 69093d925a..c8863b52d6 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Temperature.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Temperature : IQuantity
static Temperature()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 1, 0, 0);
+ Info = new QuantityInfo(QuantityType.Temperature, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Kelvin.
@@ -98,6 +99,9 @@ private Temperature(double numericValue, TemperatureUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Temperature(double numericValue, TemperatureUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public TemperatureUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -568,6 +577,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((TemperatureUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs
index b3c5128afa..d6726bb8a6 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureChangeRate.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class TemperatureChangeRate : IQuantity
static TemperatureChangeRate()
{
BaseDimensions = new BaseDimensions(0, 0, -1, 0, 1, 0, 0);
+ Info = new QuantityInfo(QuantityType.TemperatureChangeRate, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit DegreeCelsiusPerSecond.
@@ -98,6 +99,9 @@ private TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit uni
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private TemperatureChangeRate(double numericValue, TemperatureChangeRateUnit uni
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public TemperatureChangeRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -598,6 +607,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((TemperatureChangeRateUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs
index a29737d0c5..65354a33eb 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/TemperatureDelta.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class TemperatureDelta : IQuantity
static TemperatureDelta()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.TemperatureDelta, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit Kelvin.
@@ -98,6 +99,9 @@ private TemperatureDelta(double numericValue, TemperatureDeltaUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private TemperatureDelta(double numericValue, TemperatureDeltaUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public TemperatureDeltaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -568,6 +577,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((TemperatureDeltaUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs
index ebc1d99a6b..7490a60cfe 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalConductivity.WindowsRuntimeComponent.g.cs
@@ -70,6 +70,7 @@ public sealed partial class ThermalConductivity : IQuantity
static ThermalConductivity()
{
BaseDimensions = new BaseDimensions(1, 1, -3, 0, -1, 0, 0);
+ Info = new QuantityInfo(QuantityType.ThermalConductivity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit WattPerMeterKelvin.
@@ -101,6 +102,9 @@ private ThermalConductivity(double numericValue, ThermalConductivityUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -145,11 +149,16 @@ private ThermalConductivity(double numericValue, ThermalConductivityUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ThermalConductivityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -481,6 +490,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ThermalConductivityUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs
index eb7d660fdb..67a1f6e093 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/ThermalResistance.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class ThermalResistance : IQuantity
static ThermalResistance()
{
BaseDimensions = new BaseDimensions(0, -1, 3, 0, 1, 0, 0);
+ Info = new QuantityInfo(QuantityType.ThermalResistance, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit SquareMeterKelvinPerKilowatt.
@@ -98,6 +99,9 @@ private ThermalResistance(double numericValue, ThermalResistanceUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private ThermalResistance(double numericValue, ThermalResistanceUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ThermalResistanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -523,6 +532,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((ThermalResistanceUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs
index c0d5902656..20916a4b26 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Torque.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Torque : IQuantity
static Torque()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Torque, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit NewtonMeter.
@@ -98,6 +99,9 @@ private Torque(double numericValue, TorqueUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Torque(double numericValue, TorqueUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public TorqueUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -763,6 +772,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((TorqueUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs
index 1bb83af3e0..7ba67f85c4 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VitaminA.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class VitaminA : IQuantity
static VitaminA()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.VitaminA, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit InternationalUnit.
@@ -98,6 +99,9 @@ private VitaminA(double numericValue, VitaminAUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private VitaminA(double numericValue, VitaminAUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public VitaminAUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -463,6 +472,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((VitaminAUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs
index 05cfda206c..b3abc2b83e 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/Volume.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class Volume : IQuantity
static Volume()
{
BaseDimensions = new BaseDimensions(3, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Volume, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit CubicMeter.
@@ -98,6 +99,9 @@ private Volume(double numericValue, VolumeUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private Volume(double numericValue, VolumeUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public VolumeUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -1123,6 +1132,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((VolumeUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs
index e46f4ff131..9219610cb3 100644
--- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs
+++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumeFlow.WindowsRuntimeComponent.g.cs
@@ -67,6 +67,7 @@ public sealed partial class VolumeFlow : IQuantity
static VolumeFlow()
{
BaseDimensions = new BaseDimensions(3, 0, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.VolumeFlow, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions);
}
///
/// Creates the quantity with a value of 0 in the base unit CubicMeterPerSecond.
@@ -98,6 +99,9 @@ private VolumeFlow(double numericValue, VolumeFlowUnit unit)
#region Static Properties
+ ///
+ internal static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -142,11 +146,16 @@ private VolumeFlow(double numericValue, VolumeFlowUnit unit)
///
public double Value => Convert.ToDouble(_value);
+ ///
+ object IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public VolumeFlowUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ internal QuantityInfo QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -1168,6 +1177,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(object unit) => As((VolumeFlowUnit)unit);
+
///
/// Convert to the unit representation .
///
diff --git a/UnitsNet/CustomCode/Quantity.cs b/UnitsNet/CustomCode/Quantity.cs
new file mode 100644
index 0000000000..20002b116a
--- /dev/null
+++ b/UnitsNet/CustomCode/Quantity.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using UnitsNet.InternalHelpers;
+
+#if WINDOWS_UWP
+ using FromValue = System.Double;
+#else
+ using FromValue = UnitsNet.QuantityValue;
+#endif
+
+namespace UnitsNet
+{
+#if WINDOWS_UWP
+ internal
+#else
+ public
+#endif
+ partial class Quantity
+ {
+ private static readonly Lazy InfosLazy;
+
+ static Quantity()
+ {
+ var quantityTypes = Enum.GetValues(typeof(QuantityType)).Cast().Except(new[] {QuantityType.Undefined}).ToArray();
+ Types = quantityTypes;
+ Names = quantityTypes.Select(qt => qt.ToString()).ToArray();
+
+#if !WINDOWS_UWP
+ // A bunch of reflection to enumerate quantity types, instantiate with the default constructor and return its QuantityInfo property
+ InfosLazy = new Lazy(() => typeof(Length)
+ .Wrap()
+ .Assembly
+ .GetExportedTypes()
+ .Where(typeof(IQuantity).IsAssignableFrom)
+ .Where(t => t.Wrap().IsClass || t.Wrap().IsValueType) // Future-proofing: Considering changing quantities from struct to class
+ .Select(Activator.CreateInstance)
+ .Cast()
+ .Select(q => q.QuantityInfo)
+ .OrderBy(q => q.Name)
+ .ToArray());
+#endif
+ }
+
+ ///
+ /// All enum values of , such as and .
+ ///
+ public static QuantityType[] Types { get; }
+
+ ///
+ /// All enum value names of , such as "Length" and "Mass".
+ ///
+ public static string[] Names { get; }
+
+#if !WINDOWS_UWP
+ ///
+ /// All quantity information objects, such as and .
+ ///
+ public static QuantityInfo[] Infos => InfosLazy.Value;
+#endif
+
+ ///
+ /// Dynamically construct a quantity.
+ ///
+ /// Numeric value.
+ /// Unit enum value.
+ /// An object.
+ /// Unit value is not a know unit enum type.
+#if WINDOWS_UWP
+ internal static IQuantity From(FromValue value, Enum unit)
+#else
+ public static IQuantity From(FromValue value, Enum unit)
+#endif
+ {
+ if (TryFrom(value, unit, out IQuantity quantity))
+ return quantity;
+
+ throw new ArgumentException(
+ $"Unit value {unit} of type {unit.GetType()} is not a known unit enum type. Expected types like UnitsNet.Units.LengthUnit. Did you pass in a third-party enum type defined outside UnitsNet library?");
+ }
+
+ public static IEnumerable GetQuantitiesWithBaseDimensions(BaseDimensions baseDimensions)
+ {
+ return InfosLazy.Value.Where(info => info.BaseDimensions.Equals(baseDimensions));
+ }
+ }
+}
diff --git a/UnitsNet/CustomCode/QuantityParser.cs b/UnitsNet/CustomCode/QuantityParser.cs
index d6bedd5c92..d58df984a1 100644
--- a/UnitsNet/CustomCode/QuantityParser.cs
+++ b/UnitsNet/CustomCode/QuantityParser.cs
@@ -121,6 +121,27 @@ internal bool TryParse([NotNull] string str,
return TryParseWithRegex(valueString, unitString, fromDelegate, formatProvider, out result);
}
+ ///
+ /// Workaround for C# not allowing to pass on 'out' param from type Length to IQuantity, even though the are compatible.
+ ///
+ [SuppressMessage("ReSharper", "UseStringInterpolation")]
+ internal bool TryParse([NotNull] string str,
+ [CanBeNull] IFormatProvider formatProvider,
+ [NotNull] QuantityFromDelegate fromDelegate,
+ out IQuantity result)
+ where TQuantity : IQuantity
+ where TUnitType : Enum
+ {
+ if (TryParse(str, formatProvider, fromDelegate, out TQuantity parsedQuantity))
+ {
+ result = parsedQuantity;
+ return true;
+ }
+
+ result = default;
+ return false;
+ }
+
internal string CreateRegexPatternForUnit(
TUnitType unit,
IFormatProvider formatProvider,
diff --git a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
index 25c12c7b55..6e2ab49532 100644
--- a/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
+++ b/UnitsNet/CustomCode/UnitAbbreviationsCache.cs
@@ -208,7 +208,7 @@ void MapUnitToDefaultAbbreviation(Type unitType, int unitValue, IFormatProvider
private void PerformAbbreviationMapping(Type unitType, int unitValue, IFormatProvider formatProvider, bool setAsDefault, [NotNull] params string[] abbreviations)
{
- if (!unitType.IsEnum())
+ if (!unitType.Wrap().IsEnum)
throw new ArgumentException("Must be an enum type.", nameof(unitType));
if (abbreviations == null)
diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs
index 808b18b44f..7e1d3e093f 100644
--- a/UnitsNet/CustomCode/UnitParser.cs
+++ b/UnitsNet/CustomCode/UnitParser.cs
@@ -22,7 +22,6 @@
using System;
using System.Linq;
using JetBrains.Annotations;
-using UnitsNet.InternalHelpers;
using UnitsNet.Units;
// ReSharper disable once CheckNamespace
@@ -82,7 +81,7 @@ TUnitType Parse(string unitAbbreviation, [CanBeNull] IFormatProvider
#else
public
#endif
- object Parse([NotNull] string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null)
+ Enum Parse([NotNull] string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider = null)
{
if (unitAbbreviation == null) throw new ArgumentNullException(nameof(unitAbbreviation));
unitAbbreviation = unitAbbreviation.Trim();
@@ -99,7 +98,7 @@ object Parse([NotNull] string unitAbbreviation, Type unitType, [CanBeNull] IForm
switch (unitIntValues.Count)
{
case 1:
- return unitIntValues[0];
+ return (Enum) Enum.ToObject(unitType, unitIntValues[0]);
case 0:
throw new UnitNotFoundException($"Unit not found with abbreviation [{unitAbbreviation}] for unit type [{unitType}].");
default:
@@ -162,7 +161,12 @@ bool TryParse(string unitAbbreviation, [CanBeNull] IFormatProvider fo
/// The unit enum value as out result.
/// True if successful.
[PublicAPI]
- public bool TryParse(string unitAbbreviation, Type unitType, out object unit)
+#if WINDOWS_UWP
+ internal
+#else
+ public
+#endif
+ bool TryParse(string unitAbbreviation, Type unitType, out Enum unit)
{
return TryParse(unitAbbreviation, unitType, null, out unit);
}
@@ -181,7 +185,7 @@ public bool TryParse(string unitAbbreviation, Type unitType, out object unit)
#else
public
#endif
- bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out object unit)
+ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvider formatProvider, out Enum unit)
{
if (unitAbbreviation == null)
{
@@ -190,7 +194,7 @@ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvide
}
unitAbbreviation = unitAbbreviation.Trim();
- unit = GetDefault(unitType);
+ unit = default;
if(!_unitAbbreviationsCache.TryGetUnitValueAbbreviationLookup(unitType, formatProvider, out var abbreviations))
return false;
@@ -204,19 +208,8 @@ bool TryParse(string unitAbbreviation, Type unitType, [CanBeNull] IFormatProvide
if(unitIntValues.Count != 1)
return false;
- unit = unitIntValues[0];
+ unit = (Enum)Enum.ToObject(unitType, unitIntValues[0]);
return true;
}
-
- ///
- /// Get default(Type) of
- ///
- /// .
- /// Null for reference types, 0 for numeric types and default constructor for the rest.
- ///
- private static object GetDefault(Type type)
- {
- return type.IsValueType() ? Activator.CreateInstance(type): null;
- }
}
}
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs
index c270945249..016930dca8 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct Acceleration : IQuantity, IEquatable(QuantityType.Acceleration, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public Acceleration(double numericValue, AccelerationUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public Acceleration(double numericValue, AccelerationUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AccelerationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -576,12 +588,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Accele
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Acceleration left, Acceleration right)
+ public static bool operator ==(Acceleration left, Acceleration right)
{
return left.Equals(right);
}
- public static bool operator !=(Acceleration left, Acceleration right)
+ public static bool operator !=(Acceleration left, Acceleration right)
{
return !(left == right);
}
@@ -677,6 +689,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AccelerationUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -690,6 +704,8 @@ public double As(AccelerationUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AccelerationUnit) unit);
+
///
/// Converts this Acceleration to another Acceleration with the unit representation .
///
@@ -700,6 +716,10 @@ public Acceleration ToUnit(AccelerationUnit unit)
return new Acceleration(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AccelerationUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs
index 269ec5fc28..fd34f9ca2b 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct AmountOfSubstance : IQuantity, IEqu
static AmountOfSubstance()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, 0, 1, 0);
+ Info = new QuantityInfo(QuantityType.AmountOfSubstance, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public AmountOfSubstance(double numericValue, AmountOfSubstanceUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AmountOfSubstanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -604,12 +616,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amount
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right)
+ public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right)
{
return left.Equals(right);
}
- public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right)
+ public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right)
{
return !(left == right);
}
@@ -705,6 +717,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AmountOfSubstanceUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -718,6 +732,8 @@ public double As(AmountOfSubstanceUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AmountOfSubstanceUnit) unit);
+
///
/// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation .
///
@@ -728,6 +744,10 @@ public AmountOfSubstance ToUnit(AmountOfSubstanceUnit unit)
return new AmountOfSubstance(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AmountOfSubstanceUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs
index bdd2811a3c..09106f06ab 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct AmplitudeRatio : IQuantity, IEquatable
static AmplitudeRatio()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.AmplitudeRatio, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public AmplitudeRatio(double numericValue, AmplitudeRatioUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AmplitudeRatioUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -458,12 +470,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Amplit
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right)
+ public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right)
{
return left.Equals(right);
}
- public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right)
+ public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right)
{
return !(left == right);
}
@@ -559,6 +571,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AmplitudeRatioUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -572,6 +586,8 @@ public double As(AmplitudeRatioUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AmplitudeRatioUnit) unit);
+
///
/// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation .
///
@@ -582,6 +598,10 @@ public AmplitudeRatio ToUnit(AmplitudeRatioUnit unit)
return new AmplitudeRatio(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AmplitudeRatioUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs
index a40146322e..c74069868b 100644
--- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct Angle : IQuantity, IEquatable, IComparab
static Angle()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.Angle, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public Angle(double numericValue, AngleUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public Angle(double numericValue, AngleUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AngleUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -590,12 +602,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AngleU
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Angle left, Angle right)
+ public static bool operator ==(Angle left, Angle right)
{
return left.Equals(right);
}
- public static bool operator !=(Angle left, Angle right)
+ public static bool operator !=(Angle left, Angle right)
{
return !(left == right);
}
@@ -691,6 +703,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AngleUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -704,6 +718,8 @@ public double As(AngleUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AngleUnit) unit);
+
///
/// Converts this Angle to another Angle with the unit representation .
///
@@ -714,6 +730,10 @@ public Angle ToUnit(AngleUnit unit)
return new Angle(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AngleUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs
index d316073a1e..cc442448d1 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct ApparentEnergy : IQuantity, IEquatable
static ApparentEnergy()
{
BaseDimensions = new BaseDimensions(2, 1, -2, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ApparentEnergy, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public ApparentEnergy(double numericValue, ApparentEnergyUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public ApparentEnergy(double numericValue, ApparentEnergyUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ApparentEnergyUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -436,12 +448,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(ApparentEnergy left, ApparentEnergy right)
+ public static bool operator ==(ApparentEnergy left, ApparentEnergy right)
{
return left.Equals(right);
}
- public static bool operator !=(ApparentEnergy left, ApparentEnergy right)
+ public static bool operator !=(ApparentEnergy left, ApparentEnergy right)
{
return !(left == right);
}
@@ -537,6 +549,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((ApparentEnergyUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -550,6 +564,8 @@ public double As(ApparentEnergyUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((ApparentEnergyUnit) unit);
+
///
/// Converts this ApparentEnergy to another ApparentEnergy with the unit representation .
///
@@ -560,6 +576,10 @@ public ApparentEnergy ToUnit(ApparentEnergyUnit unit)
return new ApparentEnergy(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(ApparentEnergyUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((ApparentEnergyUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs
index 939303cc36..15141ed781 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct ApparentPower : IQuantity, IEquatable(QuantityType.ApparentPower, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public ApparentPower(double numericValue, ApparentPowerUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public ApparentPower(double numericValue, ApparentPowerUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ApparentPowerUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -450,12 +462,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Appare
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(ApparentPower left, ApparentPower right)
+ public static bool operator ==(ApparentPower left, ApparentPower right)
{
return left.Equals(right);
}
- public static bool operator !=(ApparentPower left, ApparentPower right)
+ public static bool operator !=(ApparentPower left, ApparentPower right)
{
return !(left == right);
}
@@ -551,6 +563,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((ApparentPowerUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -564,6 +578,8 @@ public double As(ApparentPowerUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((ApparentPowerUnit) unit);
+
///
/// Converts this ApparentPower to another ApparentPower with the unit representation .
///
@@ -574,6 +590,10 @@ public ApparentPower ToUnit(ApparentPowerUnit unit)
return new ApparentPower(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(ApparentPowerUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((ApparentPowerUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs
index cc853e61b1..640710408d 100644
--- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct Area : IQuantity, IEquatable , IComparable,
static Area()
{
BaseDimensions = new BaseDimensions(2, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Area, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public Area(double numericValue, AreaUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public Area(double numericValue, AreaUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -576,12 +588,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaUn
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Area left, Area right)
+ public static bool operator ==(Area left, Area right)
{
return left.Equals(right);
}
- public static bool operator !=(Area left, Area right)
+ public static bool operator !=(Area left, Area right)
{
return !(left == right);
}
@@ -677,6 +689,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AreaUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -690,6 +704,8 @@ public double As(AreaUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AreaUnit) unit);
+
///
/// Converts this Area to another Area with the unit representation .
///
@@ -700,6 +716,10 @@ public Area ToUnit(AreaUnit unit)
return new Area(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AreaUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs
index 981c3c9181..30a62aa818 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct AreaDensity : IQuantity, IEquatable(QuantityType.AreaDensity, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public AreaDensity(double numericValue, AreaDensityUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public AreaDensity(double numericValue, AreaDensityUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaDensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -408,12 +420,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaDe
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(AreaDensity left, AreaDensity right)
+ public static bool operator ==(AreaDensity left, AreaDensity right)
{
return left.Equals(right);
}
- public static bool operator !=(AreaDensity left, AreaDensity right)
+ public static bool operator !=(AreaDensity left, AreaDensity right)
{
return !(left == right);
}
@@ -509,6 +521,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AreaDensityUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -522,6 +536,8 @@ public double As(AreaDensityUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AreaDensityUnit) unit);
+
///
/// Converts this AreaDensity to another AreaDensity with the unit representation .
///
@@ -532,6 +548,10 @@ public AreaDensity ToUnit(AreaDensityUnit unit)
return new AreaDensity(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AreaDensityUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs
index 94a6104b6f..76416d89a6 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct AreaMomentOfInertia : IQuantity,
static AreaMomentOfInertia()
{
BaseDimensions = new BaseDimensions(4, 0, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.AreaMomentOfInertia, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public AreaMomentOfInertia(double numericValue, AreaMomentOfInertiaUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public AreaMomentOfInertiaUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -478,12 +490,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out AreaMo
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right)
+ public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right)
{
return left.Equals(right);
}
- public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right)
+ public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right)
{
return !(left == right);
}
@@ -579,6 +591,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((AreaMomentOfInertiaUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -592,6 +606,8 @@ public double As(AreaMomentOfInertiaUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((AreaMomentOfInertiaUnit) unit);
+
///
/// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation .
///
@@ -602,6 +618,10 @@ public AreaMomentOfInertia ToUnit(AreaMomentOfInertiaUnit unit)
return new AreaMomentOfInertia(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((AreaMomentOfInertiaUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
index 0b5970dc41..1a2d0142ce 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs
@@ -67,6 +67,7 @@ public partial struct BitRate : IQuantity, IEquatable, ICo
static BitRate()
{
BaseDimensions = BaseDimensions.Dimensionless;
+ Info = new QuantityInfo(QuantityType.BitRate, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -87,6 +88,9 @@ public BitRate(decimal numericValue, BitRateUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -131,11 +135,19 @@ public BitRate(decimal numericValue, BitRateUnit unit)
///
public decimal Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public BitRateUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -761,12 +773,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BitRat
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(BitRate left, BitRate right)
+ public static bool operator ==(BitRate left, BitRate right)
{
return left.Equals(right);
}
- public static bool operator !=(BitRate left, BitRate right)
+ public static bool operator !=(BitRate left, BitRate right)
{
return !(left == right);
}
@@ -862,6 +874,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((BitRateUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -875,6 +889,8 @@ public double As(BitRateUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((BitRateUnit) unit);
+
///
/// Converts this BitRate to another BitRate with the unit representation .
///
@@ -885,6 +901,10 @@ public BitRate ToUnit(BitRateUnit unit)
return new BitRate(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((BitRateUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs
index a426b07efc..d29de10dae 100644
--- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct BrakeSpecificFuelConsumption : IQuantity(QuantityType.BrakeSpecificFuelConsumption, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsum
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public BrakeSpecificFuelConsumption(double numericValue, BrakeSpecificFuelConsum
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public BrakeSpecificFuelConsumptionUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -436,12 +448,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out BrakeS
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right)
+ public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right)
{
return left.Equals(right);
}
- public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right)
+ public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right)
{
return !(left == right);
}
@@ -537,6 +549,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((BrakeSpecificFuelConsumptionUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -550,6 +564,8 @@ public double As(BrakeSpecificFuelConsumptionUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((BrakeSpecificFuelConsumptionUnit) unit);
+
///
/// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation .
///
@@ -560,6 +576,10 @@ public BrakeSpecificFuelConsumption ToUnit(BrakeSpecificFuelConsumptionUnit unit
return new BrakeSpecificFuelConsumption(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((BrakeSpecificFuelConsumptionUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs
index 781139ac3a..78c09a36de 100644
--- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs
@@ -67,6 +67,7 @@ public partial struct Capacitance : IQuantity, IEquatable(QuantityType.Capacitance, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -87,6 +88,9 @@ public Capacitance(double numericValue, CapacitanceUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -131,11 +135,19 @@ public Capacitance(double numericValue, CapacitanceUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public CapacitanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -495,12 +507,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Capaci
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Capacitance left, Capacitance right)
+ public static bool operator ==(Capacitance left, Capacitance right)
{
return left.Equals(right);
}
- public static bool operator !=(Capacitance left, Capacitance right)
+ public static bool operator !=(Capacitance left, Capacitance right)
{
return !(left == right);
}
@@ -596,6 +608,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((CapacitanceUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -609,6 +623,8 @@ public double As(CapacitanceUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((CapacitanceUnit) unit);
+
///
/// Converts this Capacitance to another Capacitance with the unit representation .
///
@@ -619,6 +635,10 @@ public Capacitance ToUnit(CapacitanceUnit unit)
return new Capacitance(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(CapacitanceUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((CapacitanceUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs
index 9e2c9d0169..d453f51075 100644
--- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct CoefficientOfThermalExpansion : IQuantity(QuantityType.CoefficientOfThermalExpansion, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalEx
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalEx
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -436,12 +448,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Coeffi
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right)
+ public static bool operator ==(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right)
{
return left.Equals(right);
}
- public static bool operator !=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right)
+ public static bool operator !=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right)
{
return !(left == right);
}
@@ -537,6 +549,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((CoefficientOfThermalExpansionUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -550,6 +564,8 @@ public double As(CoefficientOfThermalExpansionUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((CoefficientOfThermalExpansionUnit) unit);
+
///
/// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation .
///
@@ -560,6 +576,10 @@ public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit un
return new CoefficientOfThermalExpansion(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((CoefficientOfThermalExpansionUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs
index 6bd675f67e..a339a56409 100644
--- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs
@@ -67,6 +67,7 @@ public partial struct Density : IQuantity, IEquatable, ICo
static Density()
{
BaseDimensions = new BaseDimensions(-3, 1, 0, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Density, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -87,6 +88,9 @@ public Density(double numericValue, DensityUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -131,11 +135,19 @@ public Density(double numericValue, DensityUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DensityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -943,12 +955,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Densit
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Density left, Density right)
+ public static bool operator ==(Density left, Density right)
{
return left.Equals(right);
}
- public static bool operator !=(Density left, Density right)
+ public static bool operator !=(Density left, Density right)
{
return !(left == right);
}
@@ -1044,6 +1056,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((DensityUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -1057,6 +1071,8 @@ public double As(DensityUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((DensityUnit) unit);
+
///
/// Converts this Density to another Density with the unit representation .
///
@@ -1067,6 +1083,10 @@ public Density ToUnit(DensityUnit unit)
return new Density(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((DensityUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs
index 96839e6452..c036f61726 100644
--- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct Duration : IQuantity, IEquatable,
static Duration()
{
BaseDimensions = new BaseDimensions(0, 0, 1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.Duration, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public Duration(double numericValue, DurationUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public Duration(double numericValue, DurationUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DurationUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -534,12 +546,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Durati
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(Duration left, Duration right)
+ public static bool operator ==(Duration left, Duration right)
{
return left.Equals(right);
}
- public static bool operator !=(Duration left, Duration right)
+ public static bool operator !=(Duration left, Duration right)
{
return !(left == right);
}
@@ -635,6 +647,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((DurationUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -648,6 +662,8 @@ public double As(DurationUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((DurationUnit) unit);
+
///
/// Converts this Duration to another Duration with the unit representation .
///
@@ -658,6 +674,10 @@ public Duration ToUnit(DurationUnit unit)
return new Duration(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((DurationUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs
index d5c144c902..eca7bd5eb5 100644
--- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs
@@ -67,6 +67,7 @@ public partial struct DynamicViscosity : IQuantity, IEquat
static DynamicViscosity()
{
BaseDimensions = new BaseDimensions(-1, 1, -1, 0, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.DynamicViscosity, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -87,6 +88,9 @@ public DynamicViscosity(double numericValue, DynamicViscosityUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -131,11 +135,19 @@ public DynamicViscosity(double numericValue, DynamicViscosityUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public DynamicViscosityUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -481,12 +493,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Dynami
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(DynamicViscosity left, DynamicViscosity right)
+ public static bool operator ==(DynamicViscosity left, DynamicViscosity right)
{
return left.Equals(right);
}
- public static bool operator !=(DynamicViscosity left, DynamicViscosity right)
+ public static bool operator !=(DynamicViscosity left, DynamicViscosity right)
{
return !(left == right);
}
@@ -582,6 +594,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((DynamicViscosityUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -595,6 +609,8 @@ public double As(DynamicViscosityUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((DynamicViscosityUnit) unit);
+
///
/// Converts this DynamicViscosity to another DynamicViscosity with the unit representation .
///
@@ -605,6 +621,10 @@ public DynamicViscosity ToUnit(DynamicViscosityUnit unit)
return new DynamicViscosity(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((DynamicViscosityUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs
index 4fab6a781f..7a616e5826 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs
@@ -64,6 +64,7 @@ public partial struct ElectricAdmittance : IQuantity, IE
static ElectricAdmittance()
{
BaseDimensions = new BaseDimensions(-2, -1, 3, 2, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricAdmittance, Units, BaseUnit, Zero, BaseDimensions);
}
///
@@ -84,6 +85,9 @@ public ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit)
#region Static Properties
+ ///
+ public static QuantityInfo Info { get; }
+
///
/// The of this quantity.
///
@@ -128,11 +132,19 @@ public ElectricAdmittance(double numericValue, ElectricAdmittanceUnit unit)
///
public double Value => _value;
+ ///
+ Enum IQuantity.Unit => Unit;
+
///
/// The unit this quantity was constructed with -or- if default ctor was used.
///
public ElectricAdmittanceUnit Unit => _unit.GetValueOrDefault(BaseUnit);
+ public QuantityInfo QuantityInfo => Info;
+
+ ///
+ QuantityInfo IQuantity.QuantityInfo => Info;
+
///
/// The of this quantity.
///
@@ -450,12 +462,12 @@ public static bool TryParseUnit(string str, IFormatProvider provider, out Electr
return left.Value > right.AsBaseNumericType(left.Unit);
}
- public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right)
+ public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right)
{
return left.Equals(right);
}
- public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right)
+ public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right)
{
return !(left == right);
}
@@ -551,6 +563,8 @@ public override int GetHashCode()
#region Conversion Methods
+ double IQuantity.As(Enum unit) => As((ElectricAdmittanceUnit)unit);
+
///
/// Convert to the unit representation .
///
@@ -564,6 +578,8 @@ public double As(ElectricAdmittanceUnit unit)
return Convert.ToDouble(converted);
}
+ public double As(Enum unit) => As((ElectricAdmittanceUnit) unit);
+
///
/// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation .
///
@@ -574,6 +590,10 @@ public ElectricAdmittance ToUnit(ElectricAdmittanceUnit unit)
return new ElectricAdmittance(convertedValue, unit);
}
+ IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit);
+
+ public IQuantity ToUnit(Enum unit) => ToUnit((ElectricAdmittanceUnit) unit);
+
///
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs
index fb1cf38f61..cb4b59f11f 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs
@@ -67,6 +67,7 @@ public partial struct ElectricCharge : IQuantity, IEquatable
static ElectricCharge()
{
BaseDimensions = new BaseDimensions(0, 0, 1, 1, 0, 0, 0);
+ Info = new QuantityInfo(QuantityType.ElectricCharge, Units, BaseUnit, Zero, BaseDimensions);
}
///