public BaseUnit(Quantity quantity, string name, string symbol, string uiSymbol) { Name = name ?? throw new ArgumentNullException(nameof(name)); Quantity = quantity ?? throw new ArgumentNullException(nameof(quantity)); Symbol = symbol ?? throw new ArgumentNullException(nameof(symbol)); UISymbol = null; MetricSystem?.AddUnit(this); }
private static bool tryParseByFullName(string uiSymbol, out MetricSystem result) { result = MetricSystemManager.GetAllMetricSystems() .FirstOrDefault(ms => ms.FullName == uiSymbol); if (result == default) { return(false); } return(true); }
public BaseQuantity(MetricSystem metricSystem, string name, string symbol, string uiSymbol) { MetricSystem = metricSystem; Name = name ?? throw new ArgumentNullException(nameof(name)); Symbol = symbol; UISymbol = uiSymbol; MetricSystem?.AddQuantity(this); }
public MetricPrefix(MetricSystem metricSystem, double multiplier, string name, string symbol, string uiSymbol) { MetricSystem = metricSystem; Name = name; Symbol = symbol; UISymbol = uiSymbol ?? symbol; Multiplier = multiplier; MetricSystem?.AddPrefix(this); }
public static bool TryParse(string value, out MetricSystem result) => tryParseByName(value, out result) || tryParseByFullName(value, out result);
public override void Dispose() { MetricSystem?.RemoveUnit(this); }
internal static void RemoveMetricSystem(MetricSystem metricSystem) => metricSystems.Add(metricSystem);
internal static void AddMetricSystem(MetricSystem metricSystem) => metricSystems.Add(metricSystem);
public BaseQuantity(MetricSystem metricSystem, string name) : this(metricSystem, name, null, null) { }
public BaseQuantity(MetricSystem metricSystem, string name, string symbol) : this(metricSystem, name, symbol, null) { }
internal static void RemoveMetricSystem(MetricSystem metricSystem) => allMetricSystems.Remove(metricSystem);
public MetricPrefix(MetricSystem metricSystem, double multiplier, string name) : this(metricSystem, multiplier, name, null, null) { }
public BaseUnit(MetricSystem metricSystem, Quantity quantity, string name, string symbol) : this(metricSystem, quantity, name, symbol, null) { }