Exemplo n.º 1
0
    private static Units CombineUnits(Units a, Units b, Func <int, int, int> combine)
    {
        List <UnitExponent> data = new List <UnitExponent>();

        foreach (SIUnitType u in Enum.GetValues(typeof(SIUnitType)))
        {
            int exp = combine(a.ExponentFor(u), b.ExponentFor(u));

            if (exp != 0)
            {
                data.Add(new UnitExponent(u, exp));
            }
        }

        return(new Units(data));
    }