public EqToken(string value) { Value = value; Type = TokenCategory.Invalid; double dvalue; if (Double.TryParse(value, out dvalue)) { // Number Type = TokenCategory.Number; DValue = dvalue; NumberOfOperands = 0; return; } switch (value) { case ",": Type = TokenCategory.ArgumentSeparator; return; case "(": Type = TokenCategory.LeftParenthesis; return; case ")": Type = TokenCategory.RightParenthesis; return; } if (EqOperator.Operators.ContainsKey(value)) { var op = EqOperator.Operators[value]; if (op.Type == TokenCategory.Constant) { DValue = Op.Calculate(); Type = TokenCategory.Number; NumberOfOperands = 0; return; } Op = op; Type = Op.Type; NumberOfOperands = 1; } }