//поиск формулы public static PhysValue SearchFormula(Dictionary dictionary, List<OneElementInFormula> results) { var newPhysValue = new PhysValue(); foreach (var formula in dictionary.AllFormulas.Where(formula => CompareList(formula.Oneform, results))) { newPhysValue.Value = formula.Calculate(results); newPhysValue.Measure = formula.Measure; return newPhysValue; } return newPhysValue; }
public static PhysValue operator -(PhysValue pv1, PhysValue pv2) { if (pv1.Measure != pv2.Measure) { throw new InvalidOperationException("Ошибка операции"); } var newPhysvalue = new PhysValue { Value = pv1.Value - pv2.Value, Measure = pv1.Measure }; return newPhysvalue; }