1
0
mirror of https://github.com/chylex/Query.git synced 2025-07-22 14:04:33 +02:00
Query/Calculator/Math/Unit.cs

19 lines
464 B
C#

using System.Collections.Generic;
using System.Collections.Immutable;
namespace Calculator.Math;
public sealed record Unit(string ShortName, ImmutableArray<string> LongNames) {
internal void AssignNamesTo(Dictionary<string, Unit> nameToUnitDictionary) {
nameToUnitDictionary.Add(ShortName, this);
foreach (string longName in LongNames) {
nameToUnitDictionary.Add(longName, this);
}
}
public override string ToString() {
return ShortName;
}
}