public override string ToString() { char op = char.MinValue; switch (this.operation) { case CSharpMulDivOperation.Multiplication: op = '*'; break; case CSharpMulDivOperation.Division: op = '/'; break; case CSharpMulDivOperation.Remainder: op = '%'; break; case CSharpMulDivOperation.Term: return(this.RightSide.ToString()); default: return(null); } return(string.Format("{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { string op = string.Empty; switch (this.Operation) { case AssignmentOperation.SimpleAssign: op = "="; break; case AssignmentOperation.MultiplicationAssign: op = "*="; break; case AssignmentOperation.DivisionAssign: op = "/="; break; case AssignmentOperation.ModulusAssign: op = "%="; break; case AssignmentOperation.AddAssign: op = "+="; break; case AssignmentOperation.SubtractionAssign: op = "-="; break; case AssignmentOperation.LeftShiftAssign: op = "<<="; break; case AssignmentOperation.RightShiftAssign: op = ">>="; break; case AssignmentOperation.BitwiseAndAssign: op = "&="; break; case AssignmentOperation.BitwiseOrAssign: op = "|="; break; case AssignmentOperation.Term: return(this.LeftSide.ToString()); default: return(null); } return(string.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { string op = string.Empty; switch (this.Operation) { case CSharpRelationalOperation.LessThan: op = "<"; break; case CSharpRelationalOperation.LessThanOrEqualTo: op = "<="; break; case CSharpRelationalOperation.GreaterThan: op = ">"; break; case CSharpRelationalOperation.GreaterThanOrEqualTo: op = ">="; break; case CSharpRelationalOperation.TypeCheck: op = "is"; break; case CSharpRelationalOperation.TypeCastOrNull: op = "as"; break; case CSharpRelationalOperation.Term: if (this.RightSide == null) { return(null); } return(this.RightSide.ToString()); default: return(null); } //Invalid state, can't really display the format if the object is invalid. if (RightSide == null || LeftSide == null) { return(null); } return(string.Format(CultureInfo.CurrentCulture, "{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { char op = char.MinValue; switch (this.Operation) { case CSharpAddSubtOperation.Term: return(this.RightSide.ToString()); case CSharpAddSubtOperation.Addition: op = '+'; break; case CSharpAddSubtOperation.Subtraction: op = '-'; break; default: return(null); } return(string.Format("{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { string op = string.Empty; switch (this.operation) { case CSharpInequalityOperation.Term: return(this.RightSide.ToString()); case CSharpInequalityOperation.Equality: op = "=="; break; case CSharpInequalityOperation.Inequality: op = "!="; break; default: return(null); } return(string.Format("{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { string op = string.Empty; switch (this.Operation) { case CSharpShiftOperation.Term: return(this.RightSide.ToString()); case CSharpShiftOperation.LeftShift: op = "<<"; break; case CSharpShiftOperation.RightShift: op = ">>"; break; default: return(null); } return(string.Format("{0} {1} {2}", LeftSide.ToString(), op, RightSide.ToString())); }
public override string ToString() { return(LeftSide.ToString() + "=" + RightSide.ToString()); }
/// <summary> /// The operand pressed. /// </summary> /// <param name="symbol"> /// The symbol. /// </param> private void OperandPressed(char symbol) { if (this.ResultTextBox.Text != string.Empty) { if (this.MyCalculator.OperandOne.CompareTo(0.0) != 0) { double.TryParse(this.ResultTextBox.Text, out var OperandTwo); this.MyCalculator.OperandTwo = OperandTwo; this.MyCalculator.Process(); this.OperationTextBox.Text += OperandTwo; this.ResultTextBox.Text = this.MyCalculator.CurrentValue.ToString(); } // else, there is no second operand DoNothing(); double.TryParse(this.ResultTextBox.Text, out var LeftSide); this.MyCalculator.OperandOne = LeftSide; if (this.OperationTextBox.Text == string.Empty) { this.OperationTextBox.Text += LeftSide.ToString(); } this.OperationTextBox.Text += symbol.ToString(); switch (symbol) { case '+': { this.MyCalculator.Op = Calculator.Operators.Add; break; } case '-': { this.MyCalculator.Op = Calculator.Operators.Subtract; break; } case '*': { this.MyCalculator.Op = Calculator.Operators.Multiply; break; } case '/': { this.MyCalculator.Op = Calculator.Operators.Divide; break; } } this.ResultTextBox.Text = string.Empty; } else if (this.OperationTextBox.Text != string.Empty) { switch (symbol) { case '+': { this.MyCalculator.Op = Calculator.Operators.Add; break; } case '-': { this.MyCalculator.Op = Calculator.Operators.Subtract; break; } case '*': { this.MyCalculator.Op = Calculator.Operators.Multiply; break; } case '/': { this.MyCalculator.Op = Calculator.Operators.Divide; break; } } this.OperationTextBox.Text += symbol.ToString(); } }
public string ToString(IItemsManager itemsManager) { return(string.Format("{0} => {1}", LeftSide.ToString(itemsManager), RightSide.ToString(itemsManager))); }