public UnitOfMeasure CombineUnitsAsFraction(UnitOfMeasure numerator, UnitOfMeasure denominator)
        {
            var firstComponent  = new UnitOfMeasureComponent(numerator, 1);
            var secondComponent = new UnitOfMeasureComponent(denominator, -1);
            var firstDomainId   = numerator.DomainID;
            var secondDomainId  = denominator.DomainID;

            if (numerator is CompositeUnitOfMeasure)
            {
                firstDomainId = "[" + firstDomainId + "]";
            }
            if (denominator is CompositeUnitOfMeasure)
            {
                secondDomainId = "[" + secondDomainId + "]";
            }
            var newDomainId = firstDomainId + "1" + secondDomainId + "-1";

            return(new CompositeUnitOfMeasure(newDomainId, new [] { firstComponent, secondComponent }));
        }
Пример #2
0
        public UnitOfMeasure CombineUnitsAsFraction(UnitOfMeasure numerator, UnitOfMeasure denominator)
        {
            var firstComponent = new UnitOfMeasureComponent(numerator, 1);
            var secondComponent = new UnitOfMeasureComponent(denominator, -1);
            var firstDomainId = numerator.DomainID;
            var secondDomainId = denominator.DomainID;
            if (numerator is CompositeUnitOfMeasure)
                firstDomainId = "[" + firstDomainId + "]";
            if (denominator is CompositeUnitOfMeasure)
                secondDomainId = "[" + secondDomainId + "]";
            var newDomainId = firstDomainId + "1" + secondDomainId + "-1";

            return new CompositeUnitOfMeasure(newDomainId, new []{firstComponent, secondComponent});
        }